{"action":"created","comment":{"url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/comments/79294778","id":79294778,"diff_hunk":"@@ -0,0 +1,131 @@\n+#include <common-ee.h>\n+#include <kernel.h>\n+#include <string.h>\n+#include \"../dmaregs.h\"\n+#include \"../dmasend.h\"\n+#include \"../dmatags.h\"\n+#include \"emit_vifcode.h\"\n+#include \"vifunits.h\"\n+\n+void testSimpleUnpack(VIF::Unit *unit, const char *description, VIF::UnpackType unpackType, bool zeroExtend, u32 value0, u32 value1 = 0, u32 value2 = 0, u32 value3 = 0) {\n+\tunit->regs->fbrst = VIF::FBRST_RST;\n+\t\n+\tstatic const u32 packetSize = 16 * 2;\n+\tstatic const u32 vectorSize = 16 * 1;\n+\t\n+\tu8 *vuMem = unit->vuMem;\n+\tvolatile u32 *vu_32 = (volatile u32 *)vuMem;\n+\t\n+\tmemset(vuMem, 0xFF, vectorSize);\n+\tSyncDCache(vuMem, vuMem + vectorSize);\n+\t\n+\tVIF::Packet vifcode(packetSize);\n+\tvifcode.STCYCL(4, 4);\n+\tvifcode.UNPACK(unpackType, 1, 0, zeroExtend ? VIF::UNPACK_ZERO_EXTEND : VIF::UNPACK_NORMAL);\n+\tvifcode.Data32(value0);\n+\tvifcode.Data32(value1);\n+\tvifcode.Data32(value2);\n+\tvifcode.Data32(value3);\n+\t\n+\tDMA::SendSimple(unit->dmaChannel, vifcode.Raw(), packetSize);\n+\t\n+\tSyncDCache(vuMem, vuMem + vectorSize);\n+\t\n+\tprintf(\"Simple UNPACK %s - %08x - %08x - %08x - %08x\\n\", \n+\t\tdescription, vu_32[0], vu_32[1], vu_32[2], vu_32[3]);\n+}\n+\n+void testSetUnpack(VIF::Unit *unit) {\n+\tunit->regs->fbrst = VIF::FBRST_RST;\n+\t\n+\tstatic const u32 packetSize = 16 * 4;\n+\tstatic const u32 vectorSize = 16 * 256;\n+\t\n+\tu8 *vuMem = unit->vuMem;\n+\tvolatile u32 *vu_32 = (volatile u32 *)vuMem;\n+\t\n+\tmemset(vuMem, 0xFF, vectorSize);\n+\tSyncDCache(vuMem, vuMem + vectorSize);\n+\t\n+\tVIF::Packet vifcode(packetSize);\n+\tvifcode.STCOL(0xFFEEDDCC, 0xBBAA9988, 0x77665544, 0x33221100);\n+\tvifcode.STMASK(0xAAAAAAAA); //Use COL value for all writes\n+\tvifcode.STCYCL(1, 0);\n+\tvifcode.UNPACK(VIF::UNPACK_TYPE_S8, 256, 0, VIF::UNPACK_ENABLE_MASKS);\n+\t\n+\tDMA::SendSimple(unit->dmaChannel, vifcode.Raw(), packetSize);\n+\t\n+\tSyncDCache(vuMem, vuMem + vectorSize);\n+\t\n+\tprintf(\"Set 4096 bytes UNPACK - %08x - %08x - %08x - %08x\\n\", \n+\t\tvu_32[0], vu_32[1], vu_32[1022], vu_32[1023]);\n+}\n+\n+void testNoDataUnpack(VIF::Unit *unit, u32 num) {\n+\tunit->regs->fbrst = VIF::FBRST_RST;\n+\t\n+\tu32 vpsBefore = unit->regs->stat & VIF::STAT_VPS_MASK;\n+\t\n+\tstatic const u32 packetSize = 16;\n+\t\n+\tVIF::Packet vifcode(packetSize);\n+\tvifcode.NOP();\n+\tvifcode.NOP();\n+\tvifcode.STCYCL(4, 4);\n+\tvifcode.UNPACK(VIF::UNPACK_TYPE_S8, num, 0);\n+\t\n+\tDMA::SendSimple(unit->dmaChannel, vifcode.Raw(), packetSize);\n+\t\n+\tu32 vpsAfter = unit->regs->stat & VIF::STAT_VPS_MASK;\n+\t\n+\tprintf(\"No data UNPACK(NUM: %d) -> VPS before: %d, VPS after: %d, CODE: %08x, NUM: %d\\n\", \n+\t    num, vpsBefore, vpsAfter, unit->regs->code, unit->regs->num);","path":"tests/dma/vif/unpack.cpp","position":82,"original_position":82,"commit_id":"3a7badc96e7e18e9451a22ef0563fb906d5a2cc9","original_commit_id":"3a7badc96e7e18e9451a22ef0563fb906d5a2cc9","user":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"body":"Does this actually set the memory to anything?  Or just adjust the other regs?\r\n\r\n-[Unknown]","created_at":"2016-09-18T00:39:46Z","updated_at":"2016-09-18T00:43:11Z","html_url":"https://github.com/unknownbrackets/ps2autotests/pull/43#discussion_r79294778","pull_request_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/comments/79294778"},"html":{"href":"https://github.com/unknownbrackets/ps2autotests/pull/43#discussion_r79294778"},"pull_request":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43","id":85514471,"html_url":"https://github.com/unknownbrackets/ps2autotests/pull/43","diff_url":"https://github.com/unknownbrackets/ps2autotests/pull/43.diff","patch_url":"https://github.com/unknownbrackets/ps2autotests/pull/43.patch","issue_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues/43","number":43,"state":"open","locked":false,"title":"Add tests for basic UNPACK command behavior","user":{"login":"jpd002","id":6760433,"avatar_url":"https://avatars.githubusercontent.com/u/6760433?v=3","gravatar_id":"","url":"https://api.github.com/users/jpd002","html_url":"https://github.com/jpd002","followers_url":"https://api.github.com/users/jpd002/followers","following_url":"https://api.github.com/users/jpd002/following{/other_user}","gists_url":"https://api.github.com/users/jpd002/gists{/gist_id}","starred_url":"https://api.github.com/users/jpd002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpd002/subscriptions","organizations_url":"https://api.github.com/users/jpd002/orgs","repos_url":"https://api.github.com/users/jpd002/repos","events_url":"https://api.github.com/users/jpd002/events{/privacy}","received_events_url":"https://api.github.com/users/jpd002/received_events","type":"User","site_admin":false},"body":"Here's a test that covers some of UNPACK's behavior. There's lots of stuff that could be tested here, but I wanted to get some basic cases covered first. \r\n\r\nThe `testSetUnpack` case is one case I encountered while doing some debugging in Kingdom Hearts 2. I thought it was interesting because it can be used to clear 4096 bytes in VU memory without supplying any data. (it was also broken in Play!)","created_at":"2016-09-16T03:32:22Z","updated_at":"2016-09-18T00:43:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff62054def92c860ee30e5df2178b0cf2aad495a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43/commits","review_comments_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43/comments","review_comment_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues/43/comments","statuses_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/statuses/3a7badc96e7e18e9451a22ef0563fb906d5a2cc9","head":{"label":"jpd002:unpack_test","ref":"unpack_test","sha":"3a7badc96e7e18e9451a22ef0563fb906d5a2cc9","user":{"login":"jpd002","id":6760433,"avatar_url":"https://avatars.githubusercontent.com/u/6760433?v=3","gravatar_id":"","url":"https://api.github.com/users/jpd002","html_url":"https://github.com/jpd002","followers_url":"https://api.github.com/users/jpd002/followers","following_url":"https://api.github.com/users/jpd002/following{/other_user}","gists_url":"https://api.github.com/users/jpd002/gists{/gist_id}","starred_url":"https://api.github.com/users/jpd002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpd002/subscriptions","organizations_url":"https://api.github.com/users/jpd002/orgs","repos_url":"https://api.github.com/users/jpd002/repos","events_url":"https://api.github.com/users/jpd002/events{/privacy}","received_events_url":"https://api.github.com/users/jpd002/received_events","type":"User","site_admin":false},"repo":{"id":34600724,"name":"ps2autotests","full_name":"jpd002/ps2autotests","owner":{"login":"jpd002","id":6760433,"avatar_url":"https://avatars.githubusercontent.com/u/6760433?v=3","gravatar_id":"","url":"https://api.github.com/users/jpd002","html_url":"https://github.com/jpd002","followers_url":"https://api.github.com/users/jpd002/followers","following_url":"https://api.github.com/users/jpd002/following{/other_user}","gists_url":"https://api.github.com/users/jpd002/gists{/gist_id}","starred_url":"https://api.github.com/users/jpd002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpd002/subscriptions","organizations_url":"https://api.github.com/users/jpd002/orgs","repos_url":"https://api.github.com/users/jpd002/repos","events_url":"https://api.github.com/users/jpd002/events{/privacy}","received_events_url":"https://api.github.com/users/jpd002/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jpd002/ps2autotests","description":"A set of test programs run on a PS2, with accompanying results.","fork":true,"url":"https://api.github.com/repos/jpd002/ps2autotests","forks_url":"https://api.github.com/repos/jpd002/ps2autotests/forks","keys_url":"https://api.github.com/repos/jpd002/ps2autotests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jpd002/ps2autotests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jpd002/ps2autotests/teams","hooks_url":"https://api.github.com/repos/jpd002/ps2autotests/hooks","issue_events_url":"https://api.github.com/repos/jpd002/ps2autotests/issues/events{/number}","events_url":"https://api.github.com/repos/jpd002/ps2autotests/events","assignees_url":"https://api.github.com/repos/jpd002/ps2autotests/assignees{/user}","branches_url":"https://api.github.com/repos/jpd002/ps2autotests/branches{/branch}","tags_url":"https://api.github.com/repos/jpd002/ps2autotests/tags","blobs_url":"https://api.github.com/repos/jpd002/ps2autotests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jpd002/ps2autotests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jpd002/ps2autotests/git/refs{/sha}","trees_url":"https://api.github.com/repos/jpd002/ps2autotests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jpd002/ps2autotests/statuses/{sha}","languages_url":"https://api.github.com/repos/jpd002/ps2autotests/languages","stargazers_url":"https://api.github.com/repos/jpd002/ps2autotests/stargazers","contributors_url":"https://api.github.com/repos/jpd002/ps2autotests/contributors","subscribers_url":"https://api.github.com/repos/jpd002/ps2autotests/subscribers","subscription_url":"https://api.github.com/repos/jpd002/ps2autotests/subscription","commits_url":"https://api.github.com/repos/jpd002/ps2autotests/commits{/sha}","git_commits_url":"https://api.github.com/repos/jpd002/ps2autotests/git/commits{/sha}","comments_url":"https://api.github.com/repos/jpd002/ps2autotests/comments{/number}","issue_comment_url":"https://api.github.com/repos/jpd002/ps2autotests/issues/comments{/number}","contents_url":"https://api.github.com/repos/jpd002/ps2autotests/contents/{+path}","compare_url":"https://api.github.com/repos/jpd002/ps2autotests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jpd002/ps2autotests/merges","archive_url":"https://api.github.com/repos/jpd002/ps2autotests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jpd002/ps2autotests/downloads","issues_url":"https://api.github.com/repos/jpd002/ps2autotests/issues{/number}","pulls_url":"https://api.github.com/repos/jpd002/ps2autotests/pulls{/number}","milestones_url":"https://api.github.com/repos/jpd002/ps2autotests/milestones{/number}","notifications_url":"https://api.github.com/repos/jpd002/ps2autotests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jpd002/ps2autotests/labels{/name}","releases_url":"https://api.github.com/repos/jpd002/ps2autotests/releases{/id}","deployments_url":"https://api.github.com/repos/jpd002/ps2autotests/deployments","created_at":"2015-04-26T06:29:01Z","updated_at":"2016-01-17T01:51:42Z","pushed_at":"2016-09-16T02:18:41Z","git_url":"git://github.com/jpd002/ps2autotests.git","ssh_url":"git@github.com:jpd002/ps2autotests.git","clone_url":"https://github.com/jpd002/ps2autotests.git","svn_url":"https://github.com/jpd002/ps2autotests","homepage":"","size":1852,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"unknownbrackets:master","ref":"master","sha":"21510692f8754f708cb5b0034c4e34dc519693c3","user":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"repo":{"id":33571038,"name":"ps2autotests","full_name":"unknownbrackets/ps2autotests","owner":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/unknownbrackets/ps2autotests","description":"A set of test programs run on a PS2, with accompanying results.","fork":false,"url":"https://api.github.com/repos/unknownbrackets/ps2autotests","forks_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/forks","keys_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/teams","hooks_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/hooks","issue_events_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues/events{/number}","events_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/events","assignees_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/assignees{/user}","branches_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/branches{/branch}","tags_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/tags","blobs_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/git/refs{/sha}","trees_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/statuses/{sha}","languages_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/languages","stargazers_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/stargazers","contributors_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/contributors","subscribers_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/subscribers","subscription_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/subscription","commits_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/commits{/sha}","git_commits_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/git/commits{/sha}","comments_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/comments{/number}","issue_comment_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues/comments{/number}","contents_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/contents/{+path}","compare_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/merges","archive_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/downloads","issues_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues{/number}","pulls_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls{/number}","milestones_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/milestones{/number}","notifications_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/labels{/name}","releases_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/releases{/id}","deployments_url":"https://api.github.com/repos/unknownbrackets/ps2autotests/deployments","created_at":"2015-04-07T22:14:47Z","updated_at":"2016-06-26T13:03:10Z","pushed_at":"2016-09-16T03:32:22Z","git_url":"git://github.com/unknownbrackets/ps2autotests.git","ssh_url":"git@github.com:unknownbrackets/ps2autotests.git","clone_url":"https://github.com/unknownbrackets/ps2autotests.git","svn_url":"https://github.com/unknownbrackets/ps2autotests","homepage":"","size":1600,"stargazers_count":11,"watchers_count":11,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43"},"html":{"href":"https://github.com/unknownbrackets/ps2autotests/pull/43"},"issue":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues/43"},"comments":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/unknownbrackets/ps2autotests/statuses/3a7badc96e7e18e9451a22ef0563fb906d5a2cc9"}}}}
{"actor":{"display_login":"unknownbrackets"}}