[PATCH v3 2/2] drm/virtio: Implement save and restore for virtio_gpu_objects
Dmitry Osipenko
dmitry.osipenko at collabora.com
Wed Jul 9 13:26:01 UTC 2025
On 7/3/25 01:24, dongwon.kim at intel.com wrote:
> +int virtio_gpu_object_restore_all(struct virtio_gpu_device *vgdev)
> +{
> + struct virtio_gpu_object_restore *curr, *tmp;
> + struct virtio_gpu_mem_entry *ents;
> + unsigned int nents;
> + int ret;
> +
> + list_for_each_entry_safe(curr, tmp, &vgdev->obj_restore, node) {
> + ret = virtio_gpu_object_shmem_init(vgdev, curr->bo, &ents, &nents);
> + if (ret)
> + break;
> +
> + if (curr->params.blob) {
> + virtio_gpu_cmd_resource_create_blob(vgdev, curr->bo, &curr->params,
> + ents, nents);
> + } else if (curr->params.virgl) {
> + virtio_gpu_cmd_resource_create_3d(vgdev, curr->bo, &curr->params,
> + NULL, NULL);
> +
> + if (curr->bo->attached) {
> + curr->bo->attached = false;
> + virtio_gpu_object_attach(vgdev, curr->bo, ents, nents);
> + }
> + } else {
> + virtio_gpu_cmd_create_resource(vgdev, curr->bo, &curr->params,
> + NULL, NULL);
> + if (curr->bo->attached) {
> + curr->bo->attached = false;
> + virtio_gpu_object_attach(vgdev, curr->bo, ents, nents);
> + }
> + }
> + }
So, back to the old question I posted on v1 about GPU reset... we need
to re-create BOs after resume because QEMU destroyed these BOs on
VirtIO-GPU reset that happens on suspend. This should be a wrong
behaiviour to begin with. We're suspending machine, hence the host
resources shouldn't disappear on resume. Can we avoid GPU resetting on
suspend?
The VQ freezing part is good to me, it pauses VirtIO-GPU gracefully on
suspend. But resetting GPU shouldn't happen and needs to be fixed, IMO.
Not doing reset should also make QEMU suspend/resume work for 3d contexts.
--
Best regards,
Dmitry
More information about the dri-devel
mailing list