> 
> On 2025/10/04 8:35, Vivek Kasireddy wrote:
> > There are cases when a blob resource's backing might get detached
> > and re-attached again such as when the underlying object is getting
> > migrated in the Guest. In these situations, we need to obtain a new
> > dmabuf fd, which can be done by calling virtio_gpu_init_udmabuf().
>  > > Cc: Marc-André Lureau <[email protected]>
> > Cc: Alex Bennée <[email protected]>
> > Cc: Akihiko Odaki <[email protected]>
> > Cc: Dmitry Osipenko <[email protected]>
> > Signed-off-by: Vivek Kasireddy <[email protected]>
> > ---
> >   hw/display/virtio-gpu.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> > index de35902213..70e8757128 100644
> > --- a/hw/display/virtio-gpu.c
> > +++ b/hw/display/virtio-gpu.c
> > @@ -937,6 +937,10 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g,
> >           cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
> >           return;
> >       }
> > +
> > +    if (res->blob_size && res->dmabuf_fd < 0) {
> 
> Checking res->dmabuf_fd should be unnecessary because it is always < 0
> when !res->iov && res->blob_size.
I agree, it is unnecessary. I'll remove it.

Thanks,
Vivek

> 
> virtio_gpu_cleanup_mapping() is the function that sets res->iov to NULL,
> and it ensures res->dmabuf_fd < 0 by calling virtio_gpu_fini_udmabuf()
> when res->blob_size != 0.

Reply via email to