Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pgraph/hwtest: Nailed down Kelvin+ nop/sync methods.
  • Loading branch information
mwkmwkmwk committed Aug 12, 2017
1 parent ea98b5a commit 5704e9c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions hwtest/pgraph_mthd.h
Expand Up @@ -88,6 +88,7 @@ class MthdNop : public SingleMthdTest {

class MthdSync : public SingleMthdTest {
void emulate_mthd() override {}
bool is_valid_val() override;
bool is_valid_mthd() override { return !sync; }
using SingleMthdTest::SingleMthdTest;
};
Expand Down
15 changes: 14 additions & 1 deletion hwtest/pgraph_mthd_misc.cc
Expand Up @@ -119,6 +119,9 @@ class MthdNopTest : public MthdTest {
bool is_valid_val() override {
if (sync)
return val < 4;
if (pgraph_3d_class(&exp) >= PGRAPH_3D_KELVIN) {
return val == 0;
}
return true;
}
void emulate_mthd_pre() override {
Expand Down Expand Up @@ -176,7 +179,7 @@ void MthdNop::adjust_orig_mthd() {
}

void MthdNop::emulate_mthd_pre() {
if (sync) {
if (sync && pgraph_3d_class(&exp) < PGRAPH_3D_KELVIN) {
trapbit = 0;
}
}
Expand All @@ -196,6 +199,16 @@ void MthdNop::emulate_mthd() {
bool MthdNop::is_valid_val() {
if (sync)
return val < 4;
if (pgraph_3d_class(&exp) >= PGRAPH_3D_KELVIN) {
return val == 0;
}
return true;
}

bool MthdSync::is_valid_val() {
if (pgraph_3d_class(&exp) >= PGRAPH_3D_KELVIN) {
return val == 0;
}
return true;
}

Expand Down
6 changes: 2 additions & 4 deletions nvhw/pgraph_class.c
Expand Up @@ -30,12 +30,12 @@ bool nv04_pgraph_is_syncable_class(struct pgraph_state *state) {
int cls = pgraph_class(state);
bool alt = extr(state->debug_d, 16, 1) && state->chipset.card_type >= 0x10;
switch (cls) {
case 0x8a:
case 0x88:
return state->chipset.card_type >= 0x10;
case 0x62:
case 0x7b:
case 0x89:
case 0x8a:
case 0x56:
return state->chipset.card_type >= 0x10 && !alt;
case 0x79:
Expand Down Expand Up @@ -159,8 +159,6 @@ bool nv04_pgraph_is_sync_class(struct pgraph_state *state) {
}

bool nv04_pgraph_is_sync(struct pgraph_state *state) {
int cls = pgraph_class(state);
bool alt = extr(state->debug_d, 16, 1) && state->chipset.card_type >= 0x10;
if (state->chipset.card_type < 0x10)
return false;
if (nv04_pgraph_is_nv11p(&state->chipset)) {
Expand All @@ -170,7 +168,7 @@ bool nv04_pgraph_is_sync(struct pgraph_state *state) {
}
} else if (nv04_pgraph_is_nv15p(&state->chipset)) {
if (nv04_pgraph_is_syncable_class(state)) {
if (extr(state->ctx_switch_a, 26, 1) && (cls != 0x8a || !alt))
if (extr(state->ctx_switch_a, 26, 1))
return true;
}
}
Expand Down

0 comments on commit 5704e9c

Please sign in to comment.