Skip to content
Permalink
Browse files

hwtest/nv03_pgraph: Test non-render SIFC methods.

  • Loading branch information
mwkmwkmwk committed Oct 2, 2016
1 parent a19a53b commit bc3892227c7d6a66d499a6dfdd64c0a2dbdf3746
Showing with 120 additions and 6 deletions.
  1. +120 −6 hwtest/nv03_pgraph.cc
@@ -2354,7 +2354,7 @@ static int test_mthd_ifc_size(struct hwtest_ctx *ctx) {
uint32_t mthd;
bool is_in = false;
bool is_out = false;
switch (nrand48(ctx->rand48) % 9) {
switch (nrand48(ctx->rand48) % 10) {
case 0:
cls = 0xc;
mthd = 0xbf8;
@@ -2400,6 +2400,11 @@ static int test_mthd_ifc_size(struct hwtest_ctx *ctx) {
mthd = 0x318;
is_in = true;
break;
case 9:
cls = 0x15;
mthd = 0x304;
is_in = true;
break;
default:
abort();
}
@@ -2451,17 +2456,19 @@ static int test_mthd_ifc_size(struct hwtest_ctx *ctx) {
if (!is_out)
exp.misc24_0 = extr(val, 0, 16);
nv03_pgraph_vtx_cmp(&exp, 0, 3);
nv03_pgraph_vtx_cmp(&exp, 1, 7);
nv03_pgraph_vtx_cmp(&exp, 1, cls == 0x15 ? 3 : 7);
bool zero = false;
if (extr(exp.xy_misc_4[0], 28, 4) < 2)
if (!extr(exp.xy_misc_4[0], 28, 4))
zero = true;
if (extr(exp.xy_misc_4[1], 28, 4) < 2)
if (!extr(exp.xy_misc_4[1], 28, 4))
zero = true;
insrt(exp.xy_misc_0, 20, 1, zero);
insrt(exp.xy_misc_3, 12, 1, extr(val, 0, 16) < 0x20 && cls != 0x11);
if (cls != 0x15) {
insrt(exp.xy_misc_3, 12, 1, extr(val, 0, 16) < 0x20 && cls != 0x11);
}
}
insrt(exp.xy_misc_1[0], 0, 1, 0);
insrt(exp.xy_misc_1[1], 0, 1, 1);
insrt(exp.xy_misc_1[1], 0, 1, cls != 0x15);
insrt(exp.xy_misc_0, 28, 4, 0);
insrt(exp.xy_misc_3, 8, 1, 0);
nv03_pgraph_dump_state(ctx, &real);
@@ -2543,6 +2550,111 @@ static int test_mthd_itm_rect(struct hwtest_ctx *ctx) {
return HWTEST_RES_PASS;
}

static int test_mthd_sifc_diff(struct hwtest_ctx *ctx) {
int i;
for (i = 0; i < 100000; i++) {
int cls = 0x15;
int xy = jrand48(ctx->rand48) & 1;
uint32_t mthd = 0x308 + xy * 4;
uint32_t val = jrand48(ctx->rand48);
uint32_t addr = (jrand48(ctx->rand48) & 0xe000) | mthd;
uint32_t gctx = jrand48(ctx->rand48);
uint32_t grobj[4];
grobj[0] = jrand48(ctx->rand48);
grobj[1] = jrand48(ctx->rand48);
grobj[2] = jrand48(ctx->rand48);
grobj[3] = jrand48(ctx->rand48);
struct nv03_pgraph_state orig, exp, real;
nv03_pgraph_gen_state(ctx, &orig);
if (jrand48(ctx->rand48) & 1)
val &= 0xffff;
if (!(jrand48(ctx->rand48) & 3))
val &= 0x000f000f;
if (!(jrand48(ctx->rand48) & 3))
val = 0x00100000;
orig.notify &= ~0x10000;
nv03_pgraph_prep_mthd(&orig, &gctx, cls, addr);
if (jrand48(ctx->rand48) & 1)
orig.grobj = gctx & 0xffff;
nv03_pgraph_load_state(ctx, &orig);
exp = orig;
nv03_pgraph_mthd(ctx, &exp, grobj, gctx, addr, val);
exp.valid |= 0x20 << xy * 8;
if (xy)
exp.vtx_y[5] = val;
else
exp.vtx_x[5] = val;
insrt(exp.xy_misc_0, 28, 4, 0);
insrt(exp.xy_misc_1[0], 0, 1, 0);
insrt(exp.xy_misc_1[1], 0, 1, 0);
nv03_pgraph_dump_state(ctx, &real);
if (nv03_pgraph_cmp_state(&exp, &real)) {
nv03_pgraph_print_states(&orig, &exp, &real);
printf("Mthd %08x %08x %08x iter %d\n", gctx, addr, val, i);
return HWTEST_RES_FAIL;
}
}
return HWTEST_RES_PASS;
}

static int test_mthd_sifc_vtx(struct hwtest_ctx *ctx) {
int i;
for (i = 0; i < 100000; i++) {
int cls = 0x15;
uint32_t mthd = 0x318;
uint32_t val = jrand48(ctx->rand48);
uint32_t addr = (jrand48(ctx->rand48) & 0xe000) | mthd;
uint32_t gctx = jrand48(ctx->rand48);
uint32_t grobj[4];
grobj[0] = jrand48(ctx->rand48);
grobj[1] = jrand48(ctx->rand48);
grobj[2] = jrand48(ctx->rand48);
grobj[3] = jrand48(ctx->rand48);
struct nv03_pgraph_state orig, exp, real;
nv03_pgraph_gen_state(ctx, &orig);
if (jrand48(ctx->rand48) & 1)
val &= 0xffff;
if (!(jrand48(ctx->rand48) & 3))
val &= 0x000f000f;
if (!(jrand48(ctx->rand48) & 3))
val = 0x00100000;
orig.notify &= ~0x10000;
nv03_pgraph_prep_mthd(&orig, &gctx, cls, addr);
if (jrand48(ctx->rand48) & 1)
orig.grobj = gctx & 0xffff;
nv03_pgraph_load_state(ctx, &orig);
exp = orig;
nv03_pgraph_mthd(ctx, &exp, grobj, gctx, addr, val);
exp.valid |= 0x9018;
exp.vtx_x[4] = extr(val, 0, 16) << 16;
exp.vtx_y[3] = -exp.vtx_y[7];
exp.vtx_y[4] = extr(val, 16, 16) << 16;
insrt(exp.valid, 19, 1, 0);
insrt(exp.xy_misc_0, 28, 4, 0);
insrt(exp.xy_misc_1[0], 0, 1, 0);
insrt(exp.xy_misc_1[1], 0, 1, 0);
int xcstat = nv03_pgraph_clip_status(&exp, extrs(val, 4, 12), 0, false);
int ycstat = nv03_pgraph_clip_status(&exp, extrs(val, 20, 12), 1, false);
insrt(exp.xy_clip[0][0], 0, 4, xcstat);
insrt(exp.xy_clip[1][0], 0, 4, ycstat);
insrt(exp.xy_misc_3, 8, 1, 0);
nv03_pgraph_vtx_cmp(&exp, 0, 3);
nv03_pgraph_vtx_cmp(&exp, 1, 3);
insrt(exp.xy_misc_0, 20, 1, 0);
insrt(exp.xy_misc_4[0], 0, 1, 0);
insrt(exp.xy_misc_4[0], 4, 1, 0);
insrt(exp.xy_misc_4[1], 0, 1, 0);
insrt(exp.xy_misc_4[1], 4, 1, 0);
nv03_pgraph_dump_state(ctx, &real);
if (nv03_pgraph_cmp_state(&exp, &real)) {
nv03_pgraph_print_states(&orig, &exp, &real);
printf("Mthd %08x %08x %08x iter %d\n", gctx, addr, val, i);
return HWTEST_RES_FAIL;
}
}
return HWTEST_RES_PASS;
}

static int test_mthd_d3d_tex_offset(struct hwtest_ctx *ctx) {
int i;
for (i = 0; i < 10000; i++) {
@@ -3144,6 +3256,8 @@ HWTEST_DEF_GROUP(xy_mthd,
HWTEST_TEST(test_mthd_y32, 0),
HWTEST_TEST(test_mthd_ifc_size, 0),
HWTEST_TEST(test_mthd_itm_rect, 0),
HWTEST_TEST(test_mthd_sifc_diff, 0),
HWTEST_TEST(test_mthd_sifc_vtx, 0),
)

HWTEST_DEF_GROUP(d3d,

0 comments on commit bc38922

Please sign in to comment.
You can’t perform that action at this time.