Gerd Hoffmann
2019-Jul-04 11:51 UTC
[PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing
Hi,> > convert_to_hw_box(&box, &args->box); > > if (!vgdev->has_virgl_3d) { > > virtio_gpu_cmd_transfer_to_host_2d > > - (vgdev, qobj, offset, > > + (vgdev, gem_to_virtio_gpu_obj(objs->objs[0]), offset, > > box.w, box.h, box.x, box.y, NULL); > > + virtio_gpu_array_put_free(objs); > Don't we need this in non-3D case as well?No, ...> > virtio_gpu_cmd_transfer_to_host_3d > > - (vgdev, qobj, > > + (vgdev, > > vfpriv ? vfpriv->ctx_id : 0, offset, > > - args->level, &box, fence); > > - reservation_object_add_excl_fence(qobj->base.base.resv, > > - &fence->f); > > + args->level, &box, objs, fence);... 3d case passes the objs list to virtio_gpu_cmd_transfer_to_host_3d, so it gets added to the vbuf and released when the command is finished. cheers, Gerd
Chia-I Wu
2019-Jul-04 19:08 UTC
[PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing
On Thu, Jul 4, 2019 at 4:51 AM Gerd Hoffmann <kraxel at redhat.com> wrote:> > Hi, > > > > convert_to_hw_box(&box, &args->box); > > > if (!vgdev->has_virgl_3d) { > > > virtio_gpu_cmd_transfer_to_host_2d > > > - (vgdev, qobj, offset, > > > + (vgdev, gem_to_virtio_gpu_obj(objs->objs[0]), offset, > > > box.w, box.h, box.x, box.y, NULL); > > > + virtio_gpu_array_put_free(objs); > > Don't we need this in non-3D case as well? > > No, ... > > > > virtio_gpu_cmd_transfer_to_host_3d > > > - (vgdev, qobj, > > > + (vgdev, > > > vfpriv ? vfpriv->ctx_id : 0, offset, > > > - args->level, &box, fence); > > > - reservation_object_add_excl_fence(qobj->base.base.resv, > > > - &fence->f); > > > + args->level, &box, objs, fence); > > ... 3d case passes the objs list to virtio_gpu_cmd_transfer_to_host_3d, > so it gets added to the vbuf and released when the command is finished.Why doesn't this apply to virtio_gpu_cmd_transfer_to_host_2d? When object array was introduced, it was said that the object array was to keep the objects alive until the vbuf using the objects is retired.. That sounded applicable to any vbuf that uses objects.> > cheers, > Gerd >
Gerd Hoffmann
2019-Jul-05 09:05 UTC
[PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing
On Thu, Jul 04, 2019 at 12:08:14PM -0700, Chia-I Wu wrote:> On Thu, Jul 4, 2019 at 4:51 AM Gerd Hoffmann <kraxel at redhat.com> wrote: > > > > Hi, > > > > > > convert_to_hw_box(&box, &args->box); > > > > if (!vgdev->has_virgl_3d) { > > > > virtio_gpu_cmd_transfer_to_host_2d > > > > - (vgdev, qobj, offset, > > > > + (vgdev, gem_to_virtio_gpu_obj(objs->objs[0]), offset, > > > > box.w, box.h, box.x, box.y, NULL); > > > > + virtio_gpu_array_put_free(objs); > > > Don't we need this in non-3D case as well? > > > > No, ... > > > > > > virtio_gpu_cmd_transfer_to_host_3d > > > > - (vgdev, qobj, > > > > + (vgdev, > > > > vfpriv ? vfpriv->ctx_id : 0, offset, > > > > - args->level, &box, fence); > > > > - reservation_object_add_excl_fence(qobj->base.base.resv, > > > > - &fence->f); > > > > + args->level, &box, objs, fence); > > > > ... 3d case passes the objs list to virtio_gpu_cmd_transfer_to_host_3d, > > so it gets added to the vbuf and released when the command is finished. > Why doesn't this apply to virtio_gpu_cmd_transfer_to_host_2d?Hmm, yes, makes sense to handle both the same way. With virgl=off qemu processes the commands from the guest synchronously, so it'll work fine as-is. So you can't hit the theoretical race window in practice. But depending on that host-side implementation detail isn't a good idea indeed. cheers, Gerd