diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-31 01:53:09 +0100 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-31 01:53:09 +0100 |
commit | 99b2f56d896772833fe019a1e82401b4144dfb73 (patch) | |
tree | 6149051d83a98fb48c365be99e1cad0d718f53ce | |
parent | 5cf9016c5db95d5c12b18418a9d04e0c60e7c2d3 (diff) |
hwtest/pgraph: Test behavior on missing DMA objects.
-rw-r--r-- | hwtest/pgraph_class_celsius.cc | 34 | ||||
-rw-r--r-- | hwtest/pgraph_class_kelvin.cc | 36 | ||||
-rw-r--r-- | hwtest/pgraph_class_m2mf.cc | 2 | ||||
-rw-r--r-- | hwtest/pgraph_mthd.h | 41 | ||||
-rw-r--r-- | hwtest/pgraph_mthd_grobj.cc | 2 | ||||
-rw-r--r-- | hwtest/pgraph_mthd_misc.cc | 10 |
6 files changed, 49 insertions, 76 deletions
diff --git a/hwtest/pgraph_class_celsius.cc b/hwtest/pgraph_class_celsius.cc index 317ef9de..97ba0ccd 100644 --- a/hwtest/pgraph_class_celsius.cc +++ b/hwtest/pgraph_class_celsius.cc @@ -30,40 +30,6 @@ namespace hwtest { namespace pgraph { -class MthdWarning : public SingleMthdTest { - void adjust_orig_mthd() override { - if (rnd() & 1) { - val &= 0xf; - val ^= 1 << (rnd() & 0x1f); - } - } - bool is_valid_val() override { - return val < 3; - } - void emulate_mthd() override { - if (!extr(exp.nsource, 1, 1)) { - insrt(exp.notify, 24, 1, !!(val & 3)); - insrt(exp.notify, 25, 1, (val & 3) == 2); - insrt(exp.notify, 28, 3, 0); - } - } - using SingleMthdTest::SingleMthdTest; -}; - -class MthdState : public SingleMthdTest { - void adjust_orig_mthd() override { - if (rnd() & 1) { - val &= 0xf; - val ^= 1 << (rnd() & 0x1f); - } - } - void emulate_mthd() override { - insrt(exp.intr, 4, 1, 1); - exp.fifo_enable = 0; - } - using SingleMthdTest::SingleMthdTest; -}; - class MthdDmaVtx : public SingleMthdTest { bool takes_dma() override { return true; } void emulate_mthd() override { diff --git a/hwtest/pgraph_class_kelvin.cc b/hwtest/pgraph_class_kelvin.cc index d50ca1a6..391d1c50 100644 --- a/hwtest/pgraph_class_kelvin.cc +++ b/hwtest/pgraph_class_kelvin.cc @@ -30,42 +30,6 @@ namespace hwtest { namespace pgraph { -namespace { -class MthdWarning : public SingleMthdTest { - void adjust_orig_mthd() override { - if (rnd() & 1) { - val &= 0xf; - val ^= 1 << (rnd() & 0x1f); - } - } - bool is_valid_val() override { - return val < 3; - } - void emulate_mthd() override { - if (!extr(exp.nsource, 1, 1)) { - insrt(exp.notify, 24, 1, !!(val & 3)); - insrt(exp.notify, 25, 1, (val & 3) == 2); - insrt(exp.notify, 28, 3, 0); - } - } - using SingleMthdTest::SingleMthdTest; -}; - -class MthdState : public SingleMthdTest { - void adjust_orig_mthd() override { - if (rnd() & 1) { - val &= 0xf; - val ^= 1 << (rnd() & 0x1f); - } - } - void emulate_mthd() override { - insrt(exp.intr, 4, 1, 1); - exp.fifo_enable = 0; - } - using SingleMthdTest::SingleMthdTest; -}; -} - std::vector<SingleMthdTest *> EmuCelsius::mthds() { std::vector<SingleMthdTest *> res = { new MthdNop(opt, rnd(), "nop", -1, cls, 0x100), diff --git a/hwtest/pgraph_class_m2mf.cc b/hwtest/pgraph_class_m2mf.cc index b5412497..9e770268 100644 --- a/hwtest/pgraph_class_m2mf.cc +++ b/hwtest/pgraph_class_m2mf.cc @@ -174,7 +174,7 @@ std::vector<SingleMthdTest *> M2mf::mthds() { new MthdPmTrigger(opt, rnd(), "pm_trigger", -1, cls, 0x140), new MthdDmaNotify(opt, rnd(), "dma_notify", 1, cls, 0x180), new MthdDmaGrobj(opt, rnd(), "dma_in", 2, cls, 0x184, 0, DMA_R | DMA_CLR), - new MthdDmaGrobj(opt, rnd(), "dma_out", 3, cls, 0x188, 1, DMA_W), + new MthdDmaGrobj(opt, rnd(), "dma_out", 3, cls, 0x188, 1, DMA_W | DMA_CHECK_PREV), new MthdM2mfOffset(opt, rnd(), "offset_in", 4, cls, 0x30c, 0), new MthdM2mfOffset(opt, rnd(), "offset_out", 5, cls, 0x310, 1), new MthdM2mfPitch(opt, rnd(), "pitch_in", 6, cls, 0x314, 0), diff --git a/hwtest/pgraph_mthd.h b/hwtest/pgraph_mthd.h index 6a005f8c..a722d5b9 100644 --- a/hwtest/pgraph_mthd.h +++ b/hwtest/pgraph_mthd.h @@ -124,6 +124,43 @@ class MthdNotify : public SingleMthdTest { using SingleMthdTest::SingleMthdTest; }; +class MthdWarning : public SingleMthdTest { + void adjust_orig_mthd() override { + if (rnd() & 1) { + val &= 0xf; + val ^= 1 << (rnd() & 0x1f); + } + } + bool is_valid_val() override { + return val < 3; + } + void emulate_mthd() override { + if (!extr(exp.ctx_switch[1], 16, 16)) { + pgraph_state_error(&exp); + } + if (!extr(exp.nsource, 1, 1)) { + insrt(exp.notify, 24, 1, !!(val & 3)); + insrt(exp.notify, 25, 1, (val & 3) == 2); + insrt(exp.notify, 28, 3, 0); + } + } + using SingleMthdTest::SingleMthdTest; +}; + +class MthdState : public SingleMthdTest { + void adjust_orig_mthd() override { + if (rnd() & 1) { + val &= 0xf; + val ^= 1 << (rnd() & 0x1f); + } + } + void emulate_mthd() override { + insrt(exp.intr, 4, 1, 1); + exp.fifo_enable = 0; + } + using SingleMthdTest::SingleMthdTest; +}; + class MthdDmaNotify : public SingleMthdTest { bool supported() override { return chipset.card_type >= 4; @@ -138,11 +175,12 @@ enum { DMA_W = 1, DMA_CLR = 2, DMA_ALIGN = 4, + DMA_CHECK_PREV = 8, }; class MthdDmaGrobj : public SingleMthdTest { int which, ecls; - bool clr, align; + bool clr, align, check_prev; bool supported() override { return chipset.card_type >= 4; } @@ -157,6 +195,7 @@ public: ecls = 2; clr = !!(flags & DMA_CLR); align = !!(flags & DMA_ALIGN); + check_prev = !!(flags & DMA_CHECK_PREV); } }; diff --git a/hwtest/pgraph_mthd_grobj.cc b/hwtest/pgraph_mthd_grobj.cc index 14deb297..e1044e8f 100644 --- a/hwtest/pgraph_mthd_grobj.cc +++ b/hwtest/pgraph_mthd_grobj.cc @@ -157,6 +157,8 @@ void MthdDmaGrobj::emulate_mthd() { } if (prot_err) nv04_pgraph_blowup(&exp, 4); + if (check_prev && !extr(exp.ctx_switch[2], 0, 16)) + pgraph_state_error(&exp); } static void nv04_pgraph_set_ctx(struct pgraph_state *state, uint32_t grobj[4], uint32_t pobj[4], int ecls, int bit) { diff --git a/hwtest/pgraph_mthd_misc.cc b/hwtest/pgraph_mthd_misc.cc index 0430fe0f..ea03190c 100644 --- a/hwtest/pgraph_mthd_misc.cc +++ b/hwtest/pgraph_mthd_misc.cc @@ -124,12 +124,13 @@ class MthdNopTest : public MthdTest { void emulate_mthd_pre() override { if (sync) { trapbit = 0; - if (chipset.card_type >= 0x20 && nv04_pgraph_is_3d_class(&exp)) - trapbit = -1; } } void emulate_mthd() override { if (sync) { + if (!extr(exp.ctx_switch[1], 16, 16)) { + pgraph_state_error(&exp); + } if (!extr(exp.nsource, 1, 1)) { insrt(exp.notify, 20, 1, val); } @@ -177,13 +178,14 @@ void MthdNop::adjust_orig_mthd() { void MthdNop::emulate_mthd_pre() { if (sync) { trapbit = 0; - if (chipset.card_type >= 0x20 && nv04_pgraph_is_3d_class(&exp)) - trapbit = -1; } } void MthdNop::emulate_mthd() { if (sync) { + if (!extr(exp.ctx_switch[1], 16, 16)) { + pgraph_state_error(&exp); + } if (!extr(exp.nsource, 1, 1)) { insrt(exp.notify, 20, 1, val); } |