mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 21:48:36 -07:00
This commit introduces utility functions for the creation and deallocation
of QemuDmaBuf instances. Additionally, it updates all relevant sections
of the codebase to utilize these new utility functions.
v7: remove prefix, "dpy_gl_" from all helpers
qemu_dmabuf_free() returns without doing anything if input is null
(Daniel P. Berrangé <berrange@redhat.com>)
call G_DEFINE_AUTOPTR_CLEANUP_FUNC for qemu_dmabuf_free()
(Daniel P. Berrangé <berrange@redhat.com>)
v8: Introduction of helpers was removed as those were already added
by the previous commit
v9: set dmabuf->allow_fences to 'true' when dmabuf is created in
virtio_gpu_create_dmabuf()/virtio-gpu-udmabuf.c
removed unnecessary spaces were accidently added in the patch,
'ui/console: Use qemu_dmabuf_new() a...'
v11: Calling qemu_dmabuf_close was removed as closing dmabuf->fd will be
done in qemu_dmabuf_free anyway.
(Daniel P. Berrangé <berrange@redhat.com>)
v12: --- Calling qemu_dmabuf_close separately as qemu_dmabuf_free doesn't
do it.
--- 'dmabuf' is now allocated space so it should be freed at the end of
dbus_scanout_texture
v13: --- Immediately free dmabuf after it is released to prevent possible
leaking of the ptr
(Marc-André Lureau <marcandre.lureau@redhat.com>)
--- Use g_autoptr macro to define *dmabuf for auto clean up instead of
calling qemu_dmabuf_free
(Marc-André Lureau <marcandre.lureau@redhat.com>)
v14: --- (vhost-user-gpu) Change qemu_dmabuf_free back to g_clear_pointer
as it was done because of some misunderstanding (v13).
--- (vhost-user-gpu) g->dmabuf[m->scanout_id] needs to be set to NULL
to prevent freed dmabuf to be accessed again in case if(fd==-1)break;
happens (before new dmabuf is allocated). Otherwise, it would cause
invalid memory access when the same function is executed. Also NULL
check should be done before qemu_dmabuf_close (it asserts dmabuf!=NULL.).
(Marc-André Lureau <marcandre.lureau@redhat.com>)
Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Message-Id: <20240508175403.3399895-6-dongwon.kim@intel.com>
|
||
|---|---|---|
| .. | ||
| vdpa-dev.h | ||
| vhost-backend.h | ||
| vhost-scsi-common.h | ||
| vhost-scsi.h | ||
| vhost-user-base.h | ||
| vhost-user-blk.h | ||
| vhost-user-fs.h | ||
| vhost-user-gpio.h | ||
| vhost-user-i2c.h | ||
| vhost-user-rng.h | ||
| vhost-user-scmi.h | ||
| vhost-user-scsi.h | ||
| vhost-user-snd.h | ||
| vhost-user-vsock.h | ||
| vhost-user.h | ||
| vhost-vdpa.h | ||
| vhost-vsock-common.h | ||
| vhost-vsock.h | ||
| vhost.h | ||
| virtio-access.h | ||
| virtio-acpi.h | ||
| virtio-balloon.h | ||
| virtio-blk-common.h | ||
| virtio-blk.h | ||
| virtio-bus.h | ||
| virtio-crypto.h | ||
| virtio-dmabuf.h | ||
| virtio-gpu-bswap.h | ||
| virtio-gpu-pci.h | ||
| virtio-gpu-pixman.h | ||
| virtio-gpu.h | ||
| virtio-input.h | ||
| virtio-iommu.h | ||
| virtio-md-pci.h | ||
| virtio-mem.h | ||
| virtio-mmio.h | ||
| virtio-net.h | ||
| virtio-pci.h | ||
| virtio-pmem.h | ||
| virtio-rng.h | ||
| virtio-scsi.h | ||
| virtio-serial.h | ||
| virtio.h | ||