diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-27 03:31:00 +0000 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-27 03:31:00 +0000 |
commit | 7845e81c0695ffc6e0621657ac18d9a03bfab125 (patch) | |
tree | 4588f20529b43abe7e3cd6651b93f8031927cc19 | |
parent | d6c21604ff2210759a0b6a69a106fe74aa4d4826 (diff) |
hwtest/pgraph: Nailed down Celsius color logic op methods.
-rw-r--r-- | hwtest/pgraph_class_celsius.cc | 80 |
1 files changed, 78 insertions, 2 deletions
diff --git a/hwtest/pgraph_class_celsius.cc b/hwtest/pgraph_class_celsius.cc index 463a70fc..3e7d5fd4 100644 --- a/hwtest/pgraph_class_celsius.cc +++ b/hwtest/pgraph_class_celsius.cc @@ -2830,6 +2830,82 @@ class MthdCelsiusOldUnk3f8 : public SingleMthdTest { using SingleMthdTest::SingleMthdTest; }; +class MthdCelsiusColorLogicOpEnable : public SingleMthdTest { + void adjust_orig_mthd() override { + if (rnd() & 1) { + val &= 0xf; + } + if (rnd() & 1) { + val |= 1 << (rnd() & 0x1f); + if (rnd() & 1) { + val |= 1 << (rnd() & 0x1f); + } + } + if (rnd() & 1) + insrt(exp.notify, 28, 3, 0); + } + bool can_warn() override { + return true; + } + void emulate_mthd() override { + uint32_t err = 0; + if (val > 1) + err |= 1; + if (extr(exp.celsius_config_c, 8, 1)) + err |= 4; + if (err) { + warn(err); + } else { + if (!extr(exp.nsource, 1, 1)) { + insrt(exp.celsius_blend, 16, 1, val); + } + } + } + using SingleMthdTest::SingleMthdTest; +}; + +class MthdCelsiusColorLogicOpOp : public SingleMthdTest { + void adjust_orig_mthd() override { + if (rnd() & 1) { + val &= 0xffff; + if (rnd() & 1) { + val &= 0xf; + } + if (rnd() & 1) { + val |= 0x1500; + } + if (rnd() & 1) { + val |= 1 << (rnd() & 0x1f); + if (rnd() & 1) { + val |= 1 << (rnd() & 0x1f); + } + } + } + if (rnd() & 1) + insrt(exp.notify, 28, 3, 0); + } + bool can_warn() override { + return true; + } + void emulate_mthd() override { + uint32_t err = 0; + if (val >= 0x1500 && val < 0x1510) { + } else { + err |= 1; + } + if (extr(exp.celsius_config_c, 8, 1)) + err |= 4; + if (err) { + warn(err); + } else { + if (!extr(exp.nsource, 1, 1)) { + insrt(exp.celsius_blend, 12, 4, val); + } + } + } + using SingleMthdTest::SingleMthdTest; +}; + class MthdDmaZcull : public SingleMthdTest { bool takes_dma() override { return true; } void emulate_mthd() override { @@ -3318,8 +3394,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdFlipSet(opt, rnd(), "flip_modulo", -1, cls, 0x128, 1, 2), new MthdFlipBumpWrite(opt, rnd(), "flip_bump_write", -1, cls, 0x12c, 1), new UntestedMthd(opt, rnd(), "flip", -1, cls, 0x130), - new UntestedMthd(opt, rnd(), "color_logic_op_enable", -1, cls, 0xd40), // XXX - new UntestedMthd(opt, rnd(), "color_logic_op_op", -1, cls, 0xd44), // XXX + new MthdCelsiusColorLogicOpEnable(opt, rnd(), "color_logic_op_enable", -1, cls, 0xd40), + new MthdCelsiusColorLogicOpOp(opt, rnd(), "color_logic_op_op", -1, cls, 0xd44), }); } if (cls == 0x99) { |