diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-25 22:09:20 +0000 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-25 22:09:20 +0000 |
commit | 181ae9fd3091da84a82c25d1de3ecaa5a80cf9b5 (patch) | |
tree | 3b5a8b6c3fa93f8dc5fa90d1aa23d8b02e0bc285 | |
parent | a9e7283d201ff58ca631d4f02cb50567699a01d2 (diff) |
hwtest/pgraph: Convert NV4 misc mthd tests.
-rw-r--r-- | hwtest/nv04_pgraph.cc | 84 | ||||
-rw-r--r-- | hwtest/pgraph_mthd.cc | 2 | ||||
-rw-r--r-- | hwtest/pgraph_mthd_misc.cc | 68 |
3 files changed, 68 insertions, 86 deletions
diff --git a/hwtest/nv04_pgraph.cc b/hwtest/nv04_pgraph.cc index a2b4b6c3..bd5722e8 100644 --- a/hwtest/nv04_pgraph.cc +++ b/hwtest/nv04_pgraph.cc @@ -408,79 +408,6 @@ static int test_invalid_mthd_celsius(struct hwtest_ctx *ctx) { return HWTEST_RES_PASS; } -static int test_mthd_ctxsw(struct hwtest_ctx *ctx) { - int i; - for (i = 0; i < 10000; i++) { - uint32_t val = jrand48(ctx->rand48); - uint32_t cls = jrand48(ctx->rand48) & 0xff; - uint32_t addr = (jrand48(ctx->rand48) & 0xe000); - struct pgraph_state orig, exp, real; - nv04_pgraph_gen_state(ctx, &orig); - uint32_t grobj[4]; - nv04_pgraph_prep_mthd(ctx, grobj, &orig, cls, addr, val, false); - nv04_pgraph_load_state(ctx, &orig); - exp = orig; - nv04_pgraph_mthd(&exp, grobj); - nv04_pgraph_dump_state(ctx, &real); - if (nv04_pgraph_cmp_state(&orig, &exp, &real)) { - printf("Iter %d mthd %02x.%04x %08x\n", i, cls, addr, val); - return HWTEST_RES_FAIL; - } - } - return HWTEST_RES_PASS; -} - -static int test_mthd_nop(struct hwtest_ctx *ctx) { - int i; - for (i = 0; i < 10000; i++) { - uint32_t val = jrand48(ctx->rand48); - uint32_t cls = jrand48(ctx->rand48) & 0xff; - uint32_t addr = (jrand48(ctx->rand48) & 0xe000) | 0x100; - struct pgraph_state orig, exp, real; - nv04_pgraph_gen_state(ctx, &orig); - orig.notify &= ~0x10000; - uint32_t grobj[4]; - nv04_pgraph_prep_mthd(ctx, grobj, &orig, cls, addr, val, false); - nv04_pgraph_load_state(ctx, &orig); - exp = orig; - nv04_pgraph_mthd(&exp, grobj); - nv04_pgraph_dump_state(ctx, &real); - if (nv04_pgraph_cmp_state(&orig, &exp, &real)) { - printf("Iter %d mthd %02x.%04x %08x\n", i, cls, addr, val); - return HWTEST_RES_FAIL; - } - } - return HWTEST_RES_PASS; -} - -static int test_mthd_pm_trigger(struct hwtest_ctx *ctx) { - if (ctx->chipset.card_type < 0x10) - return HWTEST_RES_NA; - int i; - for (i = 0; i < 10000; i++) { - uint32_t val = jrand48(ctx->rand48); - uint32_t cls = jrand48(ctx->rand48) & 0xff; - uint32_t addr = (jrand48(ctx->rand48) & 0xe000) | 0x140; - struct pgraph_state orig, exp, real; - nv04_pgraph_gen_state(ctx, &orig); - orig.notify &= ~0x10000; - uint32_t grobj[4]; - nv04_pgraph_prep_mthd(ctx, grobj, &orig, cls, addr, val, false); - nv04_pgraph_load_state(ctx, &orig); - exp = orig; - nv04_pgraph_mthd(&exp, grobj); - if (!extr(exp.debug[3], 15, 1)) { - nv04_pgraph_blowup(&exp, 0x40); - } - nv04_pgraph_dump_state(ctx, &real); - if (nv04_pgraph_cmp_state(&orig, &exp, &real)) { - printf("Iter %d mthd %02x.%04x %08x\n", i, cls, addr, val); - return HWTEST_RES_FAIL; - } - } - return HWTEST_RES_PASS; -} - static int test_mthd_celsius_tex_offset(struct hwtest_ctx *ctx) { int i; for (i = 0; i < 10000; i++) { @@ -1297,10 +1224,6 @@ static int invalid_mthd_prep(struct hwtest_ctx *ctx) { return HWTEST_RES_PASS; } -static int simple_mthd_prep(struct hwtest_ctx *ctx) { - return HWTEST_RES_PASS; -} - static int celsius_mthd_prep(struct hwtest_ctx *ctx) { if (ctx->chipset.card_type != 0x10) return HWTEST_RES_NA; @@ -1325,12 +1248,6 @@ HWTEST_DEF_GROUP(invalid_mthd, HWTEST_TEST(test_invalid_mthd_celsius, 0), ) -HWTEST_DEF_GROUP(simple_mthd, - HWTEST_TEST(test_mthd_ctxsw, 0), - HWTEST_TEST(test_mthd_nop, 0), - HWTEST_TEST(test_mthd_pm_trigger, 0), -) - HWTEST_DEF_GROUP(celsius_mthd, HWTEST_TEST(test_mthd_celsius_tex_offset, 0), HWTEST_TEST(test_mthd_celsius_tex_format, 0), @@ -1352,6 +1269,5 @@ HWTEST_DEF_GROUP(celsius_mthd, HWTEST_DEF_GROUP(nv04_pgraph, HWTEST_GROUP(invalid_mthd), - HWTEST_GROUP(simple_mthd), HWTEST_GROUP(celsius_mthd), ) diff --git a/hwtest/pgraph_mthd.cc b/hwtest/pgraph_mthd.cc index 1dc8f506..f4b13d4b 100644 --- a/hwtest/pgraph_mthd.cc +++ b/hwtest/pgraph_mthd.cc @@ -416,6 +416,8 @@ bool MthdTest::other_fail() { bool err = false; if (chipset.card_type >= 4) { uint32_t inst = exp.ctx_switch[3] & 0xffff; + if (mthd == 0) + inst = val & 0xffff; for (int i = 0; i < 4; i++) { rgrobj[i] = nva_rd32(cnum, 0x700000 | inst << 4 | i << 2); if (rgrobj[i] != egrobj[i]) { diff --git a/hwtest/pgraph_mthd_misc.cc b/hwtest/pgraph_mthd_misc.cc index 83f668d4..f10cb5f9 100644 --- a/hwtest/pgraph_mthd_misc.cc +++ b/hwtest/pgraph_mthd_misc.cc @@ -49,8 +49,10 @@ class MthdCtxSwitchTest : public MthdTest { 0x10, 0x11, 0x12, 0x13, 0x14, }; cls = classes[rnd() % 20]; - } else { + } else if (chipset.card_type < 4) { cls = rnd() & 0x1f; + } else { + cls = rnd() & 0xff; } mthd = 0; } @@ -90,6 +92,66 @@ public: MthdCtxSwitchTest(hwtest::TestOptions &opt, uint32_t seed) : MthdTest(opt, seed) {} }; +class MthdNopTest : public MthdTest { + bool supported() override { return chipset.card_type >= 4; } + void adjust_orig_mthd() override { + if (rnd() & 1) { + val &= 0xf; + if (rnd() & 1) + val ^= 1 << (rnd() & 0x1f); + } + // XXX: this triggers DMA + if (chipset.card_type >= 0x10) + val &= ~2; + // XXX: figure this out + if (nv04_pgraph_is_nv15p(&chipset) && + (cls == 0x5f || cls == 0x9f || cls == 0x54 || cls == 0x94 || cls == 0x55 || cls == 0x95 || + cls == 0x56 || cls == 0x96 || cls == 0x98 || cls == 0x99 || cls == 0x85)) + val &= ~4; + } + void choose_mthd() override { + mthd = 0x100; + cls = rnd() & 0xff; + trapbit = -1; + } + bool is_valid_val() override { + if (sync) + return val < 4; + return true; + } + void emulate_mthd_pre() override { + if (sync) { + trapbit = 0; + } + } + void emulate_mthd() override { + if (sync) { + if (!extr(exp.nsource, 1, 1)) { + insrt(exp.notify, 20, 1, val); + } + // XXX: handle DMA + } + } +public: + MthdNopTest(hwtest::TestOptions &opt, uint32_t seed) : MthdTest(opt, seed) {} +}; + +class MthdPmTriggerTest : public MthdTest { + bool supported() override { return chipset.card_type >= 0x10; } + void choose_mthd() override { + mthd = 0x140; + cls = rnd() & 0xff; + trapbit = -1; + } + bool is_valid_mthd() override { + return extr(exp.debug[3], 15, 1); + } + void emulate_mthd() override { + } +public: + MthdPmTriggerTest(hwtest::TestOptions &opt, uint32_t seed) : MthdTest(opt, seed) {} +}; + } void MthdNop::adjust_orig_mthd() { @@ -211,12 +273,14 @@ void MthdFlipBumpWrite::emulate_mthd() { bool PGraphMthdMiscTests::supported() { - return chipset.card_type < 4; + return chipset.card_type < 0x20; } Test::Subtests PGraphMthdMiscTests::subtests() { return { {"ctx_switch", new MthdCtxSwitchTest(opt, rnd())}, + {"nop", new MthdNopTest(opt, rnd())}, + {"pm_trigger", new MthdPmTriggerTest(opt, rnd())}, }; } |