sync with OpenBSD -current
This commit is contained in:
parent
abc24a81d1
commit
921461fcd8
53 changed files with 2169 additions and 443 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "drm.h"
|
||||
#include "xf86drmMode.h"
|
||||
|
@ -175,7 +176,7 @@ int alloc_bo(uint32_t domain, uint64_t size)
|
|||
|
||||
resources[num_buffers] = bo;
|
||||
virtual[num_buffers] = addr;
|
||||
fprintf(stdout, "Allocated BO number %u at 0x%lx, domain 0x%x, size %lu\n",
|
||||
fprintf(stdout, "Allocated BO number %u at 0x%" PRIx64 ", domain 0x%x, size %" PRIu64 "\n",
|
||||
num_buffers++, addr, domain, size);
|
||||
return 0;
|
||||
}
|
||||
|
@ -273,7 +274,7 @@ int submit_ib(uint32_t from, uint32_t to, uint64_t size, uint32_t count)
|
|||
delta = stop.tv_nsec + stop.tv_sec * 1000000000UL;
|
||||
delta -= start.tv_nsec + start.tv_sec * 1000000000UL;
|
||||
|
||||
fprintf(stdout, "Submitted %u IBs to copy from %u(%lx) to %u(%lx) %lu bytes took %lu usec\n",
|
||||
fprintf(stdout, "Submitted %u IBs to copy from %u(%" PRIx64 ") to %u(%" PRIx64 ") %" PRIu64 " bytes took %" PRIu64 " usec\n",
|
||||
count, from, virtual[from], to, virtual[to], copied, delta / 1000);
|
||||
return 0;
|
||||
}
|
||||
|
@ -293,7 +294,7 @@ uint64_t parse_size(void)
|
|||
char ext[2];
|
||||
|
||||
ext[0] = 0;
|
||||
if (sscanf(optarg, "%li%1[kmgKMG]", &size, ext) < 1) {
|
||||
if (sscanf(optarg, "%" PRIi64 "%1[kmgKMG]", &size, ext) < 1) {
|
||||
fprintf(stderr, "Can't parse size arg: %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -375,7 +376,7 @@ int main(int argc, char **argv)
|
|||
next_arg(argc, argv, "Missing buffer size");
|
||||
size = parse_size();
|
||||
if (size < getpagesize()) {
|
||||
fprintf(stderr, "Buffer size to small %lu\n", size);
|
||||
fprintf(stderr, "Buffer size to small %" PRIu64 "\n", size);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
r = alloc_bo(domain, size);
|
||||
|
|
|
@ -296,18 +296,23 @@ static void display_test_suites(void)
|
|||
|
||||
/** Help string for command line parameters */
|
||||
static const char usage[] =
|
||||
"Usage: %s [-hlpr] [<-s <suite id>> [-t <test id>] [-f]] "
|
||||
"[-b <pci_bus_id> [-d <pci_device_id>]]\n"
|
||||
"where:\n"
|
||||
" l - Display all suites and their tests\n"
|
||||
" r - Run the tests on render node\n"
|
||||
" b - Specify device's PCI bus id to run tests\n"
|
||||
" d - Specify device's PCI device id to run tests (optional)\n"
|
||||
" p - Display information of AMDGPU devices in system\n"
|
||||
" f - Force executing inactive suite or test\n"
|
||||
" h - Display this help\n";
|
||||
"Usage: %s [-hlpr] [-s <suite id>] [-e <s>[.<t>] [-e ...]] [-t <test id>] [-f] "
|
||||
"[-b <pci_bus_id>] [-d <pci_device_id>]\n"
|
||||
"Where,\n"
|
||||
" -b Specify device's PCI bus id to run tests\n"
|
||||
" -d Specify device's PCI device id to run tests (optional)\n"
|
||||
" -e <s>[.<t>] Disable test <t> of suite <s>. If only <s> is given, then disable\n"
|
||||
" the whole suite. Can be specified more than once on the command line\n"
|
||||
" to disable multiple tests or suites.\n"
|
||||
" -f Force executing inactive suite or test\n"
|
||||
" -h Display this help\n"
|
||||
" -l Display all test suites and their tests\n"
|
||||
" -p Display information of AMDGPU devices in system\n"
|
||||
" -r Run the tests on render node\n"
|
||||
" -s <s> Enable only test suite <s>\n"
|
||||
" -t <t> Enable only test <t> of test suite <s>\n";
|
||||
/** Specified options strings for getopt */
|
||||
static const char options[] = "hlrps:t:b:d:f";
|
||||
static const char options[] = "hlrps:t:e:b:d:f";
|
||||
|
||||
/* Open AMD devices.
|
||||
* Return the number of AMD device opened.
|
||||
|
@ -662,6 +667,48 @@ char *amdgpu_get_device_from_fd(int fd)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(_A) (sizeof(_A)/sizeof(_A[0]))
|
||||
#endif
|
||||
|
||||
static void amdgpu_test_disable(long suite, long test)
|
||||
{
|
||||
const char *suite_name;
|
||||
|
||||
if (suite < 1)
|
||||
return;
|
||||
|
||||
/* The array is 0-based, so subract 1. */
|
||||
suite--;
|
||||
if (suite >= ARRAY_SIZE(suites) - 1)
|
||||
return;
|
||||
|
||||
suite_name = suites[suite].pName;
|
||||
if (test < 1) {
|
||||
fprintf(stderr, "Deactivating suite %s\n", suite_name);
|
||||
amdgpu_set_suite_active(suite_name, CU_FALSE);
|
||||
} else {
|
||||
int ii;
|
||||
|
||||
/* The array is 0-based so subtract 1. */
|
||||
test--;
|
||||
for (ii = 0; suites[suite].pTests[ii].pName; ii++) {
|
||||
if (ii == test) {
|
||||
fprintf(stderr, "Deactivating %s:%s\n",
|
||||
suite_name,
|
||||
suites[suite].pTests[ii].pName);
|
||||
amdgpu_set_test_active(suite_name,
|
||||
suites[suite].pTests[ii].pName,
|
||||
CU_FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (suites[suite].pTests[ii].pName == NULL)
|
||||
fprintf(stderr, "No such suite.test %ld.%ld\n", suite, test);
|
||||
}
|
||||
}
|
||||
|
||||
/* The main() function for setting up and running the tests.
|
||||
* Returns a CUE_SUCCESS on successful running, another
|
||||
* CUnit error code on failure.
|
||||
|
@ -680,48 +727,21 @@ int main(int argc, char **argv)
|
|||
int display_list = 0;
|
||||
int force_run = 0;
|
||||
|
||||
for (i = 0; i < MAX_CARDS_SUPPORTED; i++)
|
||||
drm_amdgpu[i] = -1;
|
||||
|
||||
|
||||
/* Parse command line string */
|
||||
/* Parse command line string.
|
||||
* Process various command line options as early as possible.
|
||||
*/
|
||||
opterr = 0; /* Do not print error messages from getopt */
|
||||
while ((c = getopt(argc, argv, options)) != -1) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
display_list = 1;
|
||||
break;
|
||||
case 's':
|
||||
suite_id = atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
test_id = atoi(optarg);
|
||||
break;
|
||||
case 'b':
|
||||
pci_bus_id = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
sscanf(optarg, "%x", &pci_device_id);
|
||||
break;
|
||||
case 'p':
|
||||
display_devices = 1;
|
||||
break;
|
||||
case 'r':
|
||||
open_render_node = 1;
|
||||
break;
|
||||
case 'f':
|
||||
force_run = 1;
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
fprintf(stderr, usage, argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
default:
|
||||
fprintf(stderr, usage, argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CARDS_SUPPORTED; i++)
|
||||
drm_amdgpu[i] = -1;
|
||||
|
||||
if (amdgpu_open_devices(open_render_node) <= 0) {
|
||||
perror("Cannot open AMDGPU device");
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -732,12 +752,37 @@ int main(int argc, char **argv)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Parse command line string */
|
||||
opterr = 0; /* Do not print error messages from getopt */
|
||||
optind = 1;
|
||||
while ((c = getopt(argc, argv, options)) != -1) {
|
||||
switch (c) {
|
||||
case 'p':
|
||||
display_devices = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (display_devices) {
|
||||
amdgpu_print_devices();
|
||||
amdgpu_close_devices();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Parse command line string */
|
||||
opterr = 0; /* Do not print error messages from getopt */
|
||||
optind = 1;
|
||||
while ((c = getopt(argc, argv, options)) != -1) {
|
||||
switch (c) {
|
||||
case 'b':
|
||||
pci_bus_id = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
sscanf(optarg, "%x", &pci_device_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pci_bus_id > 0 || pci_device_id) {
|
||||
/* A device was specified to run the test */
|
||||
test_device_index = amdgpu_find_device(pci_bus_id,
|
||||
|
@ -780,11 +825,85 @@ int main(int argc, char **argv)
|
|||
/* Disable suites and individual tests based on misc. conditions */
|
||||
amdgpu_disable_suites();
|
||||
|
||||
/* Parse command line string */
|
||||
opterr = 0; /* Do not print error messages from getopt */
|
||||
optind = 1;
|
||||
while ((c = getopt(argc, argv, options)) != -1) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
display_list = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (display_list) {
|
||||
display_test_suites();
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Parse command line string */
|
||||
opterr = 0; /* Do not print error messages from getopt */
|
||||
optind = 1;
|
||||
while ((c = getopt(argc, argv, options)) != -1) {
|
||||
long esuite = -1;
|
||||
long etest = -1;
|
||||
char *endp;
|
||||
switch (c) {
|
||||
case 's':
|
||||
suite_id = atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
test_id = atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
open_render_node = 1;
|
||||
break;
|
||||
case 'f':
|
||||
force_run = 1;
|
||||
break;
|
||||
case 'e':
|
||||
esuite = strtol(optarg, &endp, 0);
|
||||
if (endp == optarg) {
|
||||
fprintf(stderr, "No digits given for -e argument\n");
|
||||
goto end;
|
||||
} else if (endp && *endp == '.' && esuite > 0) {
|
||||
char *tt = endp + 1;
|
||||
etest = strtol(tt, &endp, 0);
|
||||
if (endp == tt) {
|
||||
fprintf(stderr, "No digits given for test in -e s.t argument\n");
|
||||
goto end;
|
||||
} else if (endp && *endp != '\0') {
|
||||
fprintf(stderr, "Bad input given for test in -e s.t argument\n");
|
||||
goto end;
|
||||
} else if (etest < 1) {
|
||||
fprintf(stderr, "Test in -e s.t argument cannot be smaller than 1\n");
|
||||
goto end;
|
||||
}
|
||||
} else if (endp && *endp != '\0') {
|
||||
fprintf(stderr, "Bad input given for suite for -e s argument\n");
|
||||
goto end;
|
||||
} else if (esuite < 1) {
|
||||
fprintf(stderr, "Suite in -e s argument cannot be smaller than 1\n");
|
||||
goto end;
|
||||
}
|
||||
amdgpu_test_disable(esuite, etest);
|
||||
break;
|
||||
case 'h':
|
||||
case 'p':
|
||||
case 'b':
|
||||
case 'd':
|
||||
case 'l':
|
||||
/* Those have been processed earlier.
|
||||
*/
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
fprintf(stderr, "Unknown command line option '%c'. Try -h.\n",
|
||||
c == '?' ? optopt : c);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (suite_id != -1) { /* If user specify particular suite? */
|
||||
pSuite = CU_get_suite_by_index((unsigned int) suite_id,
|
||||
CU_get_registry());
|
||||
|
|
|
@ -70,6 +70,10 @@ CU_BOOL suite_hotunplug_tests_enable(void)
|
|||
if (minor_version < 46)
|
||||
enable = false;
|
||||
|
||||
/* skip hotplug test on APUs */
|
||||
if(device_handle->dev_info.ids_flags & AMDGPU_IDS_FLAGS_FUSION)
|
||||
enable = false;
|
||||
|
||||
if (amdgpu_device_deinitialize(device_handle))
|
||||
return CU_FALSE;
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ static uint32_t *ib_checksum;
|
|||
static uint32_t *ib_size_in_dw;
|
||||
|
||||
static rvcn_decode_buffer_t *decode_buffer;
|
||||
struct amdgpu_vcn_bo session_ctx_buf;
|
||||
|
||||
static amdgpu_bo_handle resources[MAX_RESOURCES];
|
||||
static unsigned num_resources;
|
||||
|
@ -561,7 +562,9 @@ static void amdgpu_cs_vcn_dec_create(void)
|
|||
|
||||
num_resources = 0;
|
||||
alloc_resource(&msg_buf, 4096, AMDGPU_GEM_DOMAIN_GTT);
|
||||
alloc_resource(&session_ctx_buf, 32 * 4096, AMDGPU_GEM_DOMAIN_VRAM);
|
||||
resources[num_resources++] = msg_buf.handle;
|
||||
resources[num_resources++] = session_ctx_buf.handle;
|
||||
resources[num_resources++] = ib_handle;
|
||||
|
||||
r = amdgpu_bo_cpu_map(msg_buf.handle, (void **)&msg_buf.ptr);
|
||||
|
@ -571,9 +574,11 @@ static void amdgpu_cs_vcn_dec_create(void)
|
|||
memcpy(msg_buf.ptr, vcn_dec_create_msg, sizeof(vcn_dec_create_msg));
|
||||
|
||||
len = 0;
|
||||
if (vcn_dec_sw_ring == true)
|
||||
|
||||
vcn_dec_cmd(session_ctx_buf.addr, 5, &len);
|
||||
if (vcn_dec_sw_ring == true) {
|
||||
vcn_dec_cmd(msg_buf.addr, 0, &len);
|
||||
else {
|
||||
} else {
|
||||
ib_cpu[len++] = reg[vcn_reg_index].data0;
|
||||
ib_cpu[len++] = msg_buf.addr;
|
||||
ib_cpu[len++] = reg[vcn_reg_index].data1;
|
||||
|
@ -650,6 +655,7 @@ static void amdgpu_cs_vcn_dec_decode(void)
|
|||
dt_addr = ALIGN(dpb_addr + dpb_size, 4*1024);
|
||||
|
||||
len = 0;
|
||||
vcn_dec_cmd(session_ctx_buf.addr, 0x5, &len);
|
||||
vcn_dec_cmd(msg_addr, 0x0, &len);
|
||||
vcn_dec_cmd(dpb_addr, 0x1, &len);
|
||||
vcn_dec_cmd(dt_addr, 0x2, &len);
|
||||
|
@ -702,9 +708,10 @@ static void amdgpu_cs_vcn_dec_destroy(void)
|
|||
memcpy(msg_buf.ptr, vcn_dec_destroy_msg, sizeof(vcn_dec_destroy_msg));
|
||||
|
||||
len = 0;
|
||||
if (vcn_dec_sw_ring == true)
|
||||
vcn_dec_cmd(session_ctx_buf.addr, 5, &len);
|
||||
if (vcn_dec_sw_ring == true) {
|
||||
vcn_dec_cmd(msg_buf.addr, 0, &len);
|
||||
else {
|
||||
} else {
|
||||
ib_cpu[len++] = reg[vcn_reg_index].data0;
|
||||
ib_cpu[len++] = msg_buf.addr;
|
||||
ib_cpu[len++] = reg[vcn_reg_index].data1;
|
||||
|
@ -727,6 +734,7 @@ static void amdgpu_cs_vcn_dec_destroy(void)
|
|||
CU_ASSERT_EQUAL(r, 0);
|
||||
|
||||
free_resource(&msg_buf);
|
||||
free_resource(&session_ctx_buf);
|
||||
}
|
||||
|
||||
static void amdgpu_cs_vcn_enc_create(void)
|
||||
|
@ -808,6 +816,8 @@ static void amdgpu_cs_vcn_enc_create(void)
|
|||
ib_cpu[len++] = 0;
|
||||
ib_cpu[len++] = 0; /* pre encode mode */
|
||||
ib_cpu[len++] = 0; /* chroma enabled : false */
|
||||
ib_cpu[len++] = 0;
|
||||
ib_cpu[len++] = 0;
|
||||
*st_size = (len - st_offset) * 4;
|
||||
|
||||
/* slice control */
|
||||
|
@ -829,7 +839,7 @@ static void amdgpu_cs_vcn_enc_create(void)
|
|||
ib_cpu[len++] = 1; /* quarter pel enabled */
|
||||
ib_cpu[len++] = 100; /* BASELINE profile */
|
||||
ib_cpu[len++] = 11; /* level */
|
||||
if (vcn_ip_version_major == 3) {
|
||||
if (vcn_ip_version_major >= 3) {
|
||||
ib_cpu[len++] = 0; /* b_picture_enabled */
|
||||
ib_cpu[len++] = 0; /* weighted_bipred_idc */
|
||||
}
|
||||
|
@ -870,7 +880,7 @@ static void amdgpu_cs_vcn_enc_create(void)
|
|||
ib_cpu[len++] = 0; /* scene change sensitivity */
|
||||
ib_cpu[len++] = 0; /* scene change min idr interval */
|
||||
ib_cpu[len++] = 0;
|
||||
if (vcn_ip_version_major == 3)
|
||||
if (vcn_ip_version_major >= 3)
|
||||
ib_cpu[len++] = 0;
|
||||
*st_size = (len - st_offset) * 4;
|
||||
|
||||
|
@ -913,6 +923,7 @@ static void amdgpu_cs_vcn_enc_create(void)
|
|||
ib_cpu[len++] = 1;
|
||||
ib_cpu[len++] = 0;
|
||||
ib_cpu[len++] = 1;
|
||||
ib_cpu[len++] = 0;
|
||||
*st_size = (len - st_offset) * 4;
|
||||
|
||||
/* op init rc */
|
||||
|
@ -1265,10 +1276,16 @@ static void check_result(struct amdgpu_vcn_bo fb_buf, struct amdgpu_vcn_bo bs_bu
|
|||
CU_ASSERT_EQUAL(r, 0);
|
||||
}
|
||||
|
||||
static void amdgpu_cs_vcn_ib_zero_count(int *len, int num)
|
||||
{
|
||||
for (int i = 0; i < num; i++)
|
||||
ib_cpu[(*len)++] = 0;
|
||||
}
|
||||
|
||||
static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
||||
{
|
||||
struct amdgpu_vcn_bo bs_buf, fb_buf, vbv_buf;
|
||||
int len, r, i;
|
||||
struct amdgpu_vcn_bo bs_buf, fb_buf, input_buf;
|
||||
int len, r;
|
||||
unsigned width = 160, height = 128, buf_size;
|
||||
uint32_t *p_task_size = NULL;
|
||||
uint32_t task_offset = 0, st_offset;
|
||||
|
@ -1288,12 +1305,12 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
num_resources = 0;
|
||||
alloc_resource(&bs_buf, 4096, AMDGPU_GEM_DOMAIN_GTT);
|
||||
alloc_resource(&fb_buf, 4096, AMDGPU_GEM_DOMAIN_GTT);
|
||||
alloc_resource(&vbv_buf, buf_size, AMDGPU_GEM_DOMAIN_GTT);
|
||||
alloc_resource(&input_buf, buf_size, AMDGPU_GEM_DOMAIN_GTT);
|
||||
resources[num_resources++] = enc_buf.handle;
|
||||
resources[num_resources++] = cpb_buf.handle;
|
||||
resources[num_resources++] = bs_buf.handle;
|
||||
resources[num_resources++] = fb_buf.handle;
|
||||
resources[num_resources++] = vbv_buf.handle;
|
||||
resources[num_resources++] = input_buf.handle;
|
||||
resources[num_resources++] = ib_handle;
|
||||
|
||||
|
||||
|
@ -1305,13 +1322,13 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
memset(fb_buf.ptr, 0, 4096);
|
||||
r = amdgpu_bo_cpu_unmap(fb_buf.handle);
|
||||
|
||||
r = amdgpu_bo_cpu_map(vbv_buf.handle, (void **)&vbv_buf.ptr);
|
||||
r = amdgpu_bo_cpu_map(input_buf.handle, (void **)&input_buf.ptr);
|
||||
CU_ASSERT_EQUAL(r, 0);
|
||||
|
||||
for (int i = 0; i < ALIGN(height, 32) * 3 / 2; i++)
|
||||
memcpy(vbv_buf.ptr + i * ALIGN(width, 256), frame + i * width, width);
|
||||
memcpy(input_buf.ptr + i * ALIGN(width, 256), frame + i * width, width);
|
||||
|
||||
r = amdgpu_bo_cpu_unmap(vbv_buf.handle);
|
||||
r = amdgpu_bo_cpu_unmap(input_buf.handle);
|
||||
CU_ASSERT_EQUAL(r, 0);
|
||||
|
||||
len = 0;
|
||||
|
@ -1346,7 +1363,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
if(vcn_ip_version_major == 1)
|
||||
ib_cpu[len++] = 0x00000020; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 1 */
|
||||
else
|
||||
ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 2,3 */
|
||||
ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU other vcn */
|
||||
ib_cpu[len++] = 0x00000002; /* RENCODE_DIRECT_OUTPUT_NALU_TYPE_SPS */
|
||||
ib_cpu[len++] = 0x00000011; /* sps len */
|
||||
ib_cpu[len++] = 0x00000001; /* start code */
|
||||
|
@ -1362,7 +1379,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
if(vcn_ip_version_major == 1)
|
||||
ib_cpu[len++] = 0x00000020; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 1*/
|
||||
else
|
||||
ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 2,3*/
|
||||
ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU other vcn*/
|
||||
ib_cpu[len++] = 0x00000003; /* RENCODE_DIRECT_OUTPUT_NALU_TYPE_PPS */
|
||||
ib_cpu[len++] = 0x00000008; /* pps len */
|
||||
ib_cpu[len++] = 0x00000001; /* start code */
|
||||
|
@ -1376,7 +1393,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
if(vcn_ip_version_major == 1)
|
||||
ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_SLICE_HEADER vcn 1 */
|
||||
else
|
||||
ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_SLICE_HEADER vcn 2,3 */
|
||||
ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_SLICE_HEADER other vcn */
|
||||
if (frame_type == 2) {
|
||||
ib_cpu[len++] = 0x65000000;
|
||||
ib_cpu[len++] = 0x11040000;
|
||||
|
@ -1385,8 +1402,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
ib_cpu[len++] = 0x34210000;
|
||||
}
|
||||
ib_cpu[len++] = 0xe0000000;
|
||||
for(i = 0; i < 13; i++)
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
amdgpu_cs_vcn_ib_zero_count(&len, 13);
|
||||
|
||||
ib_cpu[len++] = 0x00000001;
|
||||
ib_cpu[len++] = 0x00000008;
|
||||
|
@ -1398,24 +1414,22 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
ib_cpu[len++] = 0x00000000;
|
||||
ib_cpu[len++] = 0x00000001;
|
||||
ib_cpu[len++] = 0x00000003;
|
||||
for(i = 0; i < 22; i++)
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
|
||||
amdgpu_cs_vcn_ib_zero_count(&len, 22);
|
||||
*st_size = (len - st_offset) * 4;
|
||||
|
||||
/* encode params */
|
||||
st_offset = len;
|
||||
st_size = &ib_cpu[len++]; /* size */
|
||||
if(vcn_ip_version_major == 1)
|
||||
ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 1*/
|
||||
ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 1 */
|
||||
else
|
||||
ib_cpu[len++] = 0x0000000f; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 2,3*/
|
||||
ib_cpu[len++] = 0x0000000f; /* RENCODE_IB_PARAM_ENCODE_PARAMS other vcn */
|
||||
ib_cpu[len++] = frame_type;
|
||||
ib_cpu[len++] = 0x0001f000;
|
||||
ib_cpu[len++] = vbv_buf.addr >> 32;
|
||||
ib_cpu[len++] = vbv_buf.addr;
|
||||
ib_cpu[len++] = (vbv_buf.addr + ALIGN(width, 256) * ALIGN(height, 32)) >> 32;
|
||||
ib_cpu[len++] = vbv_buf.addr + ALIGN(width, 256) * ALIGN(height, 32);
|
||||
ib_cpu[len++] = input_buf.addr >> 32;
|
||||
ib_cpu[len++] = input_buf.addr;
|
||||
ib_cpu[len++] = (input_buf.addr + ALIGN(width, 256) * ALIGN(height, 32)) >> 32;
|
||||
ib_cpu[len++] = input_buf.addr + ALIGN(width, 256) * ALIGN(height, 32);
|
||||
ib_cpu[len++] = 0x00000100;
|
||||
ib_cpu[len++] = 0x00000080;
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
|
@ -1427,7 +1441,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
st_offset = len;
|
||||
st_size = &ib_cpu[len++]; /* size */
|
||||
ib_cpu[len++] = 0x00200003; /* RENCODE_H264_IB_PARAM_ENCODE_PARAMS */
|
||||
if (vcn_ip_version_major != 3) {
|
||||
if (vcn_ip_version_major <= 2) {
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
|
@ -1450,6 +1464,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
ib_cpu[len++] = 0x00000000;
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
ib_cpu[len++] = 0x00000001;
|
||||
}
|
||||
*st_size = (len - st_offset) * 4;
|
||||
|
||||
|
@ -1459,20 +1474,21 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
if(vcn_ip_version_major == 1)
|
||||
ib_cpu[len++] = 0x0000000d; /* ENCODE_CONTEXT_BUFFER vcn 1 */
|
||||
else
|
||||
ib_cpu[len++] = 0x00000011; /* ENCODE_CONTEXT_BUFFER vcn 2,3 */
|
||||
ib_cpu[len++] = 0x00000011; /* ENCODE_CONTEXT_BUFFER other vcn */
|
||||
ib_cpu[len++] = cpb_buf.addr >> 32;
|
||||
ib_cpu[len++] = cpb_buf.addr;
|
||||
ib_cpu[len++] = 0x00000000; /* swizzle mode */
|
||||
ib_cpu[len++] = 0x00000100; /* luma pitch */
|
||||
ib_cpu[len++] = 0x00000100; /* chroma pitch */
|
||||
ib_cpu[len++] = 0x00000003; /* no reconstructed picture */
|
||||
ib_cpu[len++] = 0x00000002; /* no reconstructed picture */
|
||||
ib_cpu[len++] = 0x00000000; /* reconstructed pic 1 luma offset */
|
||||
ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32); /* pic1 chroma offset */
|
||||
if(vcn_ip_version_major == 4)
|
||||
amdgpu_cs_vcn_ib_zero_count(&len, 2);
|
||||
ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32) * 3 / 2; /* pic2 luma offset */
|
||||
ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32) * 5 / 2; /* pic2 chroma offset */
|
||||
|
||||
for (int i = 0; i < 136; i++)
|
||||
ib_cpu[len++] = 0x00000000;
|
||||
amdgpu_cs_vcn_ib_zero_count(&len, 280);
|
||||
*st_size = (len - st_offset) * 4;
|
||||
|
||||
/* bitstream buffer */
|
||||
|
@ -1481,7 +1497,8 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
if(vcn_ip_version_major == 1)
|
||||
ib_cpu[len++] = 0x0000000e; /* VIDEO_BITSTREAM_BUFFER vcn 1 */
|
||||
else
|
||||
ib_cpu[len++] = 0x00000012; /* VIDEO_BITSTREAM_BUFFER vcn 2,3 */
|
||||
ib_cpu[len++] = 0x00000012; /* VIDEO_BITSTREAM_BUFFER other vcn */
|
||||
|
||||
ib_cpu[len++] = 0x00000000; /* mode */
|
||||
ib_cpu[len++] = bs_buf.addr >> 32;
|
||||
ib_cpu[len++] = bs_buf.addr;
|
||||
|
@ -1564,7 +1581,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type)
|
|||
|
||||
free_resource(&fb_buf);
|
||||
free_resource(&bs_buf);
|
||||
free_resource(&vbv_buf);
|
||||
free_resource(&input_buf);
|
||||
}
|
||||
|
||||
static void amdgpu_cs_vcn_enc_encode(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue