Skip to content

Commit bc38922

Browse files
author
Marcin Kościelnicki
committed
hwtest/nv03_pgraph: Test non-render SIFC methods.
1 parent a19a53b commit bc38922

File tree

1 file changed

+120
-6
lines changed

1 file changed

+120
-6
lines changed

hwtest/nv03_pgraph.cc

Lines changed: 120 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ static int test_mthd_ifc_size(struct hwtest_ctx *ctx) {
23542354
uint32_t mthd;
23552355
bool is_in = false;
23562356
bool is_out = false;
2357-
switch (nrand48(ctx->rand48) % 9) {
2357+
switch (nrand48(ctx->rand48) % 10) {
23582358
case 0:
23592359
cls = 0xc;
23602360
mthd = 0xbf8;
@@ -2400,6 +2400,11 @@ static int test_mthd_ifc_size(struct hwtest_ctx *ctx) {
24002400
mthd = 0x318;
24012401
is_in = true;
24022402
break;
2403+
case 9:
2404+
cls = 0x15;
2405+
mthd = 0x304;
2406+
is_in = true;
2407+
break;
24032408
default:
24042409
abort();
24052410
}
@@ -2451,17 +2456,19 @@ static int test_mthd_ifc_size(struct hwtest_ctx *ctx) {
24512456
if (!is_out)
24522457
exp.misc24_0 = extr(val, 0, 16);
24532458
nv03_pgraph_vtx_cmp(&exp, 0, 3);
2454-
nv03_pgraph_vtx_cmp(&exp, 1, 7);
2459+
nv03_pgraph_vtx_cmp(&exp, 1, cls == 0x15 ? 3 : 7);
24552460
bool zero = false;
2456-
if (extr(exp.xy_misc_4[0], 28, 4) < 2)
2461+
if (!extr(exp.xy_misc_4[0], 28, 4))
24572462
zero = true;
2458-
if (extr(exp.xy_misc_4[1], 28, 4) < 2)
2463+
if (!extr(exp.xy_misc_4[1], 28, 4))
24592464
zero = true;
24602465
insrt(exp.xy_misc_0, 20, 1, zero);
2461-
insrt(exp.xy_misc_3, 12, 1, extr(val, 0, 16) < 0x20 && cls != 0x11);
2466+
if (cls != 0x15) {
2467+
insrt(exp.xy_misc_3, 12, 1, extr(val, 0, 16) < 0x20 && cls != 0x11);
2468+
}
24622469
}
24632470
insrt(exp.xy_misc_1[0], 0, 1, 0);
2464-
insrt(exp.xy_misc_1[1], 0, 1, 1);
2471+
insrt(exp.xy_misc_1[1], 0, 1, cls != 0x15);
24652472
insrt(exp.xy_misc_0, 28, 4, 0);
24662473
insrt(exp.xy_misc_3, 8, 1, 0);
24672474
nv03_pgraph_dump_state(ctx, &real);
@@ -2543,6 +2550,111 @@ static int test_mthd_itm_rect(struct hwtest_ctx *ctx) {
25432550
return HWTEST_RES_PASS;
25442551
}
25452552

2553+
static int test_mthd_sifc_diff(struct hwtest_ctx *ctx) {
2554+
int i;
2555+
for (i = 0; i < 100000; i++) {
2556+
int cls = 0x15;
2557+
int xy = jrand48(ctx->rand48) & 1;
2558+
uint32_t mthd = 0x308 + xy * 4;
2559+
uint32_t val = jrand48(ctx->rand48);
2560+
uint32_t addr = (jrand48(ctx->rand48) & 0xe000) | mthd;
2561+
uint32_t gctx = jrand48(ctx->rand48);
2562+
uint32_t grobj[4];
2563+
grobj[0] = jrand48(ctx->rand48);
2564+
grobj[1] = jrand48(ctx->rand48);
2565+
grobj[2] = jrand48(ctx->rand48);
2566+
grobj[3] = jrand48(ctx->rand48);
2567+
struct nv03_pgraph_state orig, exp, real;
2568+
nv03_pgraph_gen_state(ctx, &orig);
2569+
if (jrand48(ctx->rand48) & 1)
2570+
val &= 0xffff;
2571+
if (!(jrand48(ctx->rand48) & 3))
2572+
val &= 0x000f000f;
2573+
if (!(jrand48(ctx->rand48) & 3))
2574+
val = 0x00100000;
2575+
orig.notify &= ~0x10000;
2576+
nv03_pgraph_prep_mthd(&orig, &gctx, cls, addr);
2577+
if (jrand48(ctx->rand48) & 1)
2578+
orig.grobj = gctx & 0xffff;
2579+
nv03_pgraph_load_state(ctx, &orig);
2580+
exp = orig;
2581+
nv03_pgraph_mthd(ctx, &exp, grobj, gctx, addr, val);
2582+
exp.valid |= 0x20 << xy * 8;
2583+
if (xy)
2584+
exp.vtx_y[5] = val;
2585+
else
2586+
exp.vtx_x[5] = val;
2587+
insrt(exp.xy_misc_0, 28, 4, 0);
2588+
insrt(exp.xy_misc_1[0], 0, 1, 0);
2589+
insrt(exp.xy_misc_1[1], 0, 1, 0);
2590+
nv03_pgraph_dump_state(ctx, &real);
2591+
if (nv03_pgraph_cmp_state(&exp, &real)) {
2592+
nv03_pgraph_print_states(&orig, &exp, &real);
2593+
printf("Mthd %08x %08x %08x iter %d\n", gctx, addr, val, i);
2594+
return HWTEST_RES_FAIL;
2595+
}
2596+
}
2597+
return HWTEST_RES_PASS;
2598+
}
2599+
2600+
static int test_mthd_sifc_vtx(struct hwtest_ctx *ctx) {
2601+
int i;
2602+
for (i = 0; i < 100000; i++) {
2603+
int cls = 0x15;
2604+
uint32_t mthd = 0x318;
2605+
uint32_t val = jrand48(ctx->rand48);
2606+
uint32_t addr = (jrand48(ctx->rand48) & 0xe000) | mthd;
2607+
uint32_t gctx = jrand48(ctx->rand48);
2608+
uint32_t grobj[4];
2609+
grobj[0] = jrand48(ctx->rand48);
2610+
grobj[1] = jrand48(ctx->rand48);
2611+
grobj[2] = jrand48(ctx->rand48);
2612+
grobj[3] = jrand48(ctx->rand48);
2613+
struct nv03_pgraph_state orig, exp, real;
2614+
nv03_pgraph_gen_state(ctx, &orig);
2615+
if (jrand48(ctx->rand48) & 1)
2616+
val &= 0xffff;
2617+
if (!(jrand48(ctx->rand48) & 3))
2618+
val &= 0x000f000f;
2619+
if (!(jrand48(ctx->rand48) & 3))
2620+
val = 0x00100000;
2621+
orig.notify &= ~0x10000;
2622+
nv03_pgraph_prep_mthd(&orig, &gctx, cls, addr);
2623+
if (jrand48(ctx->rand48) & 1)
2624+
orig.grobj = gctx & 0xffff;
2625+
nv03_pgraph_load_state(ctx, &orig);
2626+
exp = orig;
2627+
nv03_pgraph_mthd(ctx, &exp, grobj, gctx, addr, val);
2628+
exp.valid |= 0x9018;
2629+
exp.vtx_x[4] = extr(val, 0, 16) << 16;
2630+
exp.vtx_y[3] = -exp.vtx_y[7];
2631+
exp.vtx_y[4] = extr(val, 16, 16) << 16;
2632+
insrt(exp.valid, 19, 1, 0);
2633+
insrt(exp.xy_misc_0, 28, 4, 0);
2634+
insrt(exp.xy_misc_1[0], 0, 1, 0);
2635+
insrt(exp.xy_misc_1[1], 0, 1, 0);
2636+
int xcstat = nv03_pgraph_clip_status(&exp, extrs(val, 4, 12), 0, false);
2637+
int ycstat = nv03_pgraph_clip_status(&exp, extrs(val, 20, 12), 1, false);
2638+
insrt(exp.xy_clip[0][0], 0, 4, xcstat);
2639+
insrt(exp.xy_clip[1][0], 0, 4, ycstat);
2640+
insrt(exp.xy_misc_3, 8, 1, 0);
2641+
nv03_pgraph_vtx_cmp(&exp, 0, 3);
2642+
nv03_pgraph_vtx_cmp(&exp, 1, 3);
2643+
insrt(exp.xy_misc_0, 20, 1, 0);
2644+
insrt(exp.xy_misc_4[0], 0, 1, 0);
2645+
insrt(exp.xy_misc_4[0], 4, 1, 0);
2646+
insrt(exp.xy_misc_4[1], 0, 1, 0);
2647+
insrt(exp.xy_misc_4[1], 4, 1, 0);
2648+
nv03_pgraph_dump_state(ctx, &real);
2649+
if (nv03_pgraph_cmp_state(&exp, &real)) {
2650+
nv03_pgraph_print_states(&orig, &exp, &real);
2651+
printf("Mthd %08x %08x %08x iter %d\n", gctx, addr, val, i);
2652+
return HWTEST_RES_FAIL;
2653+
}
2654+
}
2655+
return HWTEST_RES_PASS;
2656+
}
2657+
25462658
static int test_mthd_d3d_tex_offset(struct hwtest_ctx *ctx) {
25472659
int i;
25482660
for (i = 0; i < 10000; i++) {
@@ -3144,6 +3256,8 @@ HWTEST_DEF_GROUP(xy_mthd,
31443256
HWTEST_TEST(test_mthd_y32, 0),
31453257
HWTEST_TEST(test_mthd_ifc_size, 0),
31463258
HWTEST_TEST(test_mthd_itm_rect, 0),
3259+
HWTEST_TEST(test_mthd_sifc_diff, 0),
3260+
HWTEST_TEST(test_mthd_sifc_vtx, 0),
31473261
)
31483262

31493263
HWTEST_DEF_GROUP(d3d,

0 commit comments

Comments
 (0)