mirror_qemu/hw/vfio
Dongwon Kim c0fcd6334f ui/console: Use qemu_dmabuf_new() and free() helpers instead
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>
2024-05-14 17:14:12 +04:00
..
Kconfig hw/vfio: Move the IGD quirk code to a separate file 2020-02-06 11:55:42 -07:00
amd-xgbe.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
ap.c hw/vfio/ap: Fix missing ERRP_GUARD() for error_prepend() 2024-03-12 11:45:34 +01:00
calxeda-xgmac.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
ccw.c vfio: Introduce a helper function to initialize VFIODevice 2023-12-19 19:03:38 +01:00
common.c memory: Add Error** argument to .log_global_start() handler 2024-04-23 18:36:01 -04:00
container-base.c vfio/container: Introduce a VFIOIOMMU QOM interface 2024-01-05 21:25:20 +01:00
container.c * Add missing ERRP_GUARD() statements in functions that need it 2024-03-12 16:55:42 +00:00
cpr.c vfio: allow cpr-reboot migration if suspended 2024-03-08 22:10:13 +01:00
display.c ui/console: Use qemu_dmabuf_new() and free() helpers instead 2024-05-14 17:14:12 +04:00
helpers.c hw/vfio/helpers: Fix missing ERRP_GUARD() for error_prepend() 2024-03-12 11:45:34 +01:00
igd.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
iommufd.c vfio/iommufd: Fix memory leak 2024-03-19 11:56:37 +01:00
meson.build vfio: register container for cpr 2024-03-08 22:10:13 +01:00
migration.c migration: Add Error** argument to .load_setup() handler 2024-04-23 18:36:01 -04:00
pci-quirks.c hw/vfio/pci-quirks: Fix missing ERRP_GUARD() for error_prepend() 2024-03-12 11:45:45 +01:00
pci.c hw/vfio/pci: Fix missing ERRP_GUARD() for error_prepend() 2024-03-12 11:45:45 +01:00
pci.h vfio/pci: Introduce a vfio pci hot reset interface 2023-12-19 19:03:38 +01:00
platform.c hw/vfio/platform: Fix missing ERRP_GUARD() for error_prepend() 2024-03-12 11:45:45 +01:00
spapr.c vfio/spapr: Introduce a sPAPR VFIOIOMMU QOM interface 2024-01-05 21:25:20 +01:00
trace-events migration: MigrationEvent for notifiers 2024-02-28 11:31:28 +08:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00