diff --git a/Packaging/OpenDingux/build.sh b/Packaging/OpenDingux/build.sh index 9eb016fe9..cdaeac663 100755 --- a/Packaging/OpenDingux/build.sh +++ b/Packaging/OpenDingux/build.sh @@ -41,7 +41,6 @@ declare BUILD_TYPE=release main() { parse_args "$@" - BUILD_DIR="build-${TARGET}" BUILDROOT_TARGET="$TARGET" # If a TOOLCHAIN environment variable is set, just use that. @@ -100,6 +99,7 @@ parse_args() { exit 64 fi TARGET="${positional[0]}" + BUILD_DIR="build-${TARGET}" if (( PROFILE_GENERATE )) && (( PROFILE_USE )); then >&2 echo "Error: at most one of --profile-use and --profile-generate is allowed" @@ -115,9 +115,19 @@ parse_args() { OPK_EXTRA_FILES=( Packaging/OpenDingux/profile-generate.sh test/fixtures/timedemo/WarriorLevel1to2/demo_0.dmo + ) + local -a demo_saves=( test/fixtures/timedemo/WarriorLevel1to2/demo_0_reference_spawn_0.sv test/fixtures/timedemo/WarriorLevel1to2/spawn_0.sv ) + if [[ $TARGET = rg99 ]]; then + # We use unpacked saves on RG99. + mkdir -p "$BUILD_DIR/demo-saves" + unpack_and_minify_mpq --output-dir "$BUILD_DIR/demo-saves" "${demo_saves[@]}" + OPK_EXTRA_FILES+=("$BUILD_DIR/demo-saves"/*) + else + OPK_EXTRA_FILES+=("${demo_saves[@]}") + fi fi if (( PROFILE_USE )); then CMAKE_CONFIGURE_OPTS+=( diff --git a/Packaging/OpenDingux/profile-generate.sh b/Packaging/OpenDingux/profile-generate.sh index 67c63676a..ee3067f45 100755 --- a/Packaging/OpenDingux/profile-generate.sh +++ b/Packaging/OpenDingux/profile-generate.sh @@ -3,8 +3,8 @@ set -x SAVE_DIR="$(mktemp -d)" -ln -s "${PWD}/demo_0_reference_spawn_0.sv" "${SAVE_DIR}/" +ln -s "${PWD}/demo_0_reference_spawn_0_sv" "${SAVE_DIR}/" ln -s "${PWD}/demo_0.dmo" "${SAVE_DIR}/" -cp "${PWD}/spawn_0.sv" "${SAVE_DIR}/" +cp -r "${PWD}/spawn_0_sv" "${SAVE_DIR}/" ./devilutionx --diablo --spawn --demo 0 --timedemo --save-dir "$SAVE_DIR" --data-dir ~/.local/share/diasurgical/devilution rm -rf "$SAVE_DIR" diff --git a/Packaging/OpenDingux/rg99-pgo.md b/Packaging/OpenDingux/rg99-pgo.md new file mode 100644 index 000000000..f03e0492e --- /dev/null +++ b/Packaging/OpenDingux/rg99-pgo.md @@ -0,0 +1,37 @@ +# RG99 profile-guided optimization + +The RG99 build must be PGO'd for reasonable performance. + +Here are the instructions for producing a PGO'd build. + +1. Install + +2. Build the OPK for profiling data collection: + + ```sh + TOOLCHAIN=/opt/rs90-toolchain Packaging/OpenDingux/build.sh rg99 --profile-generate + ``` + +3. Copy the OPK to RG99 (`rg99` is 10.1.1.3): + + ```sh + scp -O build-rg99/devilutionx-rg99.opk rg99:/media/sdcard/apps + ``` + +4. Now, run the OPK. It will run the timedemo instead of the actual game and will take about 1 hour (due to heavy swapping). + + +5. Copy the profiling data from RG99: + + ```sh + rm -rf /tmp/devilutionx-profile + scp -r -O rg99:/media/data/local/home/devilutionx-profile /tmp/devilutionx-profile + ``` + +6. Build the OPK use the collected profiling data: + + ```sh + TOOLCHAIN=/opt/rs90-toolchain Packaging/OpenDingux/build.sh rg99 --profile-use --profile-dir /tmp/devilutionx-profile + ``` + +7. The final package is at `build-rg99/devilutionx-rg99.opk`.