Compare commits

...

3 commits

Author SHA1 Message Date
antangelo f0e8f31b1e
Merge 3e633bbbc0 into 5a144a3fd3 2024-05-08 05:55:42 +03:00
Mason Thompson 5a144a3fd3
ci: Update actions to silence Node 16 warnings 2024-05-06 16:00:55 -07:00
Antonio Abbatangelo 3e633bbbc0
nv2a: Move snapshot surface download into savevm hook 2023-08-19 21:53:56 -04:00
5 changed files with 47 additions and 36 deletions

View file

@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone tree
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Extract image metadata (tags, labels)
id: meta
uses: docker/metadata-action@v4.3.0
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
@ -35,16 +35,16 @@ jobs:
type=ref,event=branch
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.2.1
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v3.2.0
uses: docker/build-push-action@v5
with:
context: ubuntu-win64-cross
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}

View file

@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone tree
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# On push to master, increment patch version and create a new tag on release
@ -48,7 +48,7 @@ jobs:
./scripts/archive-source.sh src.tar
gzip -1 src.tar
- name: Upload source package artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: src.tar.gz
path: src.tar.gz
@ -71,14 +71,14 @@ jobs:
steps:
- name: Download source package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: src.tar.gz
- name: Extract source package
run: tar xf src.tar.gz
- name: Initialize compiler cache
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/xemu-ccache
key: cache-wincross-${{ runner.os }}-${{ matrix.configuration }}-${{ github.sha }}
@ -97,7 +97,7 @@ jobs:
$DOCKER_IMAGE_NAME \
bash -c "ccache -z; ./build.sh -p win64-cross ${{ matrix.build_param }} && ccache -s"
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist
@ -118,7 +118,7 @@ jobs:
artifact_name: xemu-win-release
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}
@ -132,7 +132,7 @@ jobs:
7z a -tzip ../dist/${{ matrix.artifact_name }}.zip * "-xr!*.pdb"
7z a -tzip ../dist/${{ matrix.artifact_name }}-pdb.zip "-ir!*.pdb"
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}-pdb
path: dist
@ -155,13 +155,13 @@ jobs:
steps:
- name: Initialize compiler cache
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/xemu-ccache
key: cache-${{ runner.os }}-${{ matrix.configuration }}-${{ github.sha }}
restore-keys: cache-${{ runner.os }}-${{ matrix.configuration }}-
- name: Download source package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: src.tar.gz
- name: Extract source package
@ -169,7 +169,7 @@ jobs:
mkdir src
tar -C src -xf src.tar.gz
- name: Clone Debian packaging
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: deb
path: debian-tmp
@ -232,7 +232,7 @@ jobs:
run: |
tar -czvf ${{ matrix.artifact_filename }} --transform "s#^dist#xemu#" dist
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_filename }}
@ -266,7 +266,7 @@ jobs:
artifact_filename: xemu-macos-arm64-release.zip
steps:
- name: Download source package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: src.tar.gz
- name: Extract source package
@ -284,7 +284,7 @@ jobs:
python3 -m pip install pyyaml requests
- name: Initialize compiler, library cache
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
xemu-ccache
@ -304,7 +304,7 @@ jobs:
zip -r ../${{ matrix.artifact_filename }} *
popd
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_filename }}
@ -318,12 +318,12 @@ jobs:
configuration: ["debug", "release"]
steps:
- name: Download x86_64 build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: xemu-macos-x86_64-${{ matrix.configuration }}
path: xemu-macos-x86_64-${{ matrix.configuration }}
- name: Download arm64 build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: xemu-macos-arm64-${{ matrix.configuration }}
path: xemu-macos-arm64-${{ matrix.configuration }}
@ -347,7 +347,7 @@ jobs:
zip -r ../xemu-macos-universal-${{ matrix.configuration }}.zip *
popd
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: xemu-macos-universal-${{ matrix.configuration }}
path: xemu-macos-universal-${{ matrix.configuration }}.zip
@ -358,7 +358,7 @@ jobs:
needs: [Ubuntu, macOSUniversal, WindowsPdb]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: dist
- name: Extract source package
@ -411,7 +411,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download source package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: src.tar.gz
- name: Extract source package
@ -419,7 +419,7 @@ jobs:
mkdir src
tar -C src -xf src.tar.gz
- name: Clone Debian packaging
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: deb
path: debian-tmp

View file

@ -21,6 +21,8 @@
#include "hw/xbox/nv2a/nv2a_int.h"
static NV2AState *g_nv2a;
void nv2a_update_irq(NV2AState *d)
{
/* PFIFO */
@ -362,17 +364,7 @@ static void qdev_nv2a_reset(DeviceState *dev)
static void nv2a_vm_state_change(void *opaque, bool running, RunState state)
{
NV2AState *d = opaque;
if (state == RUN_STATE_SAVE_VM) {
nv2a_lock_fifo(d);
qatomic_set(&d->pfifo.halt, true);
qatomic_set(&d->pgraph.download_dirty_surfaces_pending, true);
qemu_event_reset(&d->pgraph.dirty_surfaces_download_complete);
nv2a_unlock_fifo(d);
qemu_mutex_unlock_iothread();
qemu_event_wait(&d->pgraph.dirty_surfaces_download_complete);
qemu_mutex_lock_iothread();
nv2a_lock_fifo(d);
} else if (state == RUN_STATE_RESTORE_VM) {
if (state == RUN_STATE_RESTORE_VM) {
nv2a_lock_fifo(d);
qatomic_set(&d->pfifo.halt, true);
nv2a_unlock_fifo(d);
@ -391,6 +383,19 @@ static void nv2a_vm_state_change(void *opaque, bool running, RunState state)
}
}
void nv2a_save_vm_state(void)
{
nv2a_lock_fifo(g_nv2a);
qatomic_set(&g_nv2a->pfifo.halt, true);
qatomic_set(&g_nv2a->pgraph.download_dirty_surfaces_pending, true);
qemu_event_reset(&g_nv2a->pgraph.dirty_surfaces_download_complete);
nv2a_unlock_fifo(g_nv2a);
qemu_mutex_unlock_iothread();
qemu_event_wait(&g_nv2a->pgraph.dirty_surfaces_download_complete);
qemu_mutex_lock_iothread();
nv2a_lock_fifo(g_nv2a);
}
static int nv2a_post_save(void *opaque)
{
NV2AState *d = opaque;
@ -590,6 +595,7 @@ void nv2a_init(PCIBus *bus, int devfn, MemoryRegion *ram)
{
PCIDevice *dev = pci_create_simple(bus, devfn, "nv2a");
NV2AState *d = NV2A_DEVICE(dev);
g_nv2a = d;
nv2a_init_memory(d, ram);
nv2a_init_vga(d);
qemu_add_vm_change_state_handler(nv2a_vm_state_change, d);

View file

@ -28,5 +28,6 @@ void nv2a_set_surface_scale_factor(unsigned int scale);
unsigned int nv2a_get_surface_scale_factor(void);
const uint8_t *nv2a_get_dac_palette(void);
int nv2a_get_screen_off(void);
void nv2a_save_vm_state(void);
#endif

View file

@ -68,6 +68,7 @@
#include "yank_functions.h"
#include "ui/xemu-snapshots.h"
#include "hw/xbox/nv2a/nv2a.h"
const unsigned int postcopy_ram_discard_version;
@ -2854,6 +2855,9 @@ bool save_snapshot(const char *name, bool overwrite, const char *vmstate,
return false;
}
vm_stop(RUN_STATE_SAVE_VM);
#ifdef XBOX
nv2a_save_vm_state();
#endif
bdrv_drain_all_begin();