qemu/hw/display
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
..
acpi-vga-stub.c acpi: pc: vga: use AcpiDevAmlIf interface to build VGA device descriptors 2022-11-07 14:00:29 -05:00
acpi-vga.c acpi: pc: vga: use AcpiDevAmlIf interface to build VGA device descriptors 2022-11-07 14:00:29 -05:00
artist.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
ati_2d.c hw/display/ati: allow compiling without PIXMAN 2023-11-07 14:04:25 +04:00
ati_dbg.c ati-vga: Add 30 bit palette access register 2023-11-06 15:58:43 +04:00
ati_int.h ati-vga: Implement fallback for pixman routines 2023-11-06 15:58:45 +04:00
ati_regs.h ati-vga: Add 30 bit palette access register 2023-11-06 15:58:43 +04:00
ati.c bulk: Access existing variables initialized to &S->F when available 2024-03-12 11:46:16 +01:00
bcm2835_fb.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
blizzard.c hw/display: fix tab indentation 2022-11-08 10:23:32 +01:00
bochs-display.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
cg3.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
cirrus_vga_internal.h hw/display/cirrus_vga: Move "isa-cirrus-vga" device into a separate file 2018-10-15 09:57:33 +02:00
cirrus_vga_isa.c display: include dependencies explicitly 2022-11-10 10:17:18 -05:00
cirrus_vga_rop2.h cirrus: fix PUTPIXEL macro 2017-03-27 12:14:45 +02:00
cirrus_vga_rop.h cirrus: fix off-by-one in cirrus_bitblt_rop_bkwd_transp_*_16 2017-03-17 10:23:44 +01:00
cirrus_vga.c vga: implement horizontal pel panning in graphics modes 2024-01-18 10:43:13 +01:00
dm163.c hw/display : Add device DM163 2024-04-30 16:02:43 +01:00
dpcd.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
edid-generate.c edid: Fix clock of Detailed Timing Descriptor 2022-03-04 11:31:46 +01:00
edid-region.c Include exec/memory.h slightly less 2019-08-16 13:31:52 +02:00
exynos4210_fimd.c hw/display/exynos4210_fimd: Pass frame buffer memory region as link 2024-02-26 18:40:09 +01:00
framebuffer.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
framebuffer.h framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer 2015-07-24 13:57:45 +02:00
g364fb.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
i2c-ddc.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
jazz_led.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
Kconfig hw/display : Add device DM163 2024-04-30 16:02:43 +01:00
macfb.c hw/display/macfb: Fix missing ERRP_GUARD() in macfb_nubus_realize() 2024-03-12 11:45:33 +01:00
meson.build build: do not build virtio-vga-gl if virgl/opengl not available 2024-05-03 15:47:48 +02:00
next-fb.c hw/display/next-fb: Fix comment typo 2022-12-03 22:07:07 +01:00
omap_dss.c hw/arm/omap: Drop useless casts from void * to pointer 2023-01-12 17:15:09 +00:00
omap_lcdc.c hw/arm/omap: Drop useless casts from void * to pointer 2023-01-12 17:15:09 +00:00
pl110_template.h Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
pl110.c hw/display/pl110: Pass frame buffer memory region as link property 2024-02-26 18:39:58 +01:00
pxa2xx_lcd.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
qxl-logger.c hw/display/qxl: Pass requested buffer size to qxl_phys2virt() 2022-11-29 18:15:26 -05:00
qxl-render.c ui: rename cursor_{put->unref} 2023-03-13 22:57:39 +04:00
qxl.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
qxl.h Replace "iothread lock" with "BQL" in comments 2024-01-08 10:45:43 -05:00
ramfb-standalone.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
ramfb-stubs.c ramfb: move stubs out of stubs/ 2024-04-18 11:17:27 +02:00
ramfb.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
sii9022.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
sm501.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
ssd0303.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
ssd0323.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
tc6393xb.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
tcx.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
trace-events hw/display : Add device DM163 2024-04-30 16:02:43 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vga_int.h display: remove GraphicHwOps from typedefs.h 2024-05-03 15:47:48 +02:00
vga_regs.h vga: sort-of implement word and double-word access modes 2024-01-18 10:43:14 +01:00
vga-access.h vga: move access helpers to separate include file 2019-09-19 10:37:46 +02:00
vga-helpers.h vga: optimize horizontal pel panning in 256-color modes 2024-01-18 10:43:14 +01:00
vga-isa.c docs/specs/standard-vga: Convert to rST 2023-11-02 12:52:06 +00:00
vga-mmio.c display: include dependencies explicitly 2022-11-10 10:17:18 -05:00
vga-pci.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
vga.c exec: Declare target_words_bigendian() in 'exec/tswap.h' 2024-04-26 17:03:05 +02:00
vhost-user-gpu-pci.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
vhost-user-gpu.c ui/console: Use qemu_dmabuf_new() and free() helpers instead 2024-05-14 17:14:12 +04:00
vhost-user-vga.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-dmabuf.c hw/display: fix memleak from virtio_add_resource 2023-10-22 05:18:16 -04:00
virtio-gpu-base.c Fix bugs when VM shutdown with virtio-gpu unplugged 2023-12-26 04:51:07 -05:00
virtio-gpu-gl.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-gpu-pci-gl.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-gpu-pci-rutabaga.c virtio-gpu-rutabaga: Add empty interface to fix arm64 crash 2023-11-06 14:25:30 +04:00
virtio-gpu-pci.c virtio-gpu: hostmem 2023-10-16 11:29:56 +04:00
virtio-gpu-rutabaga.c virtio-gpu-rutabaga.c: override resource_destroy method 2024-02-14 06:17:44 -05:00
virtio-gpu-udmabuf-stubs.c virtio-gpu: splitting one extended mode guest fb into n-scanouts 2021-11-05 12:29:19 +01:00
virtio-gpu-udmabuf.c ui/console: Use qemu_dmabuf_new() and free() helpers instead 2024-05-14 17:14:12 +04:00
virtio-gpu-virgl.c virtio-gpu: Correct virgl_renderer_resource_get_info() error check 2024-02-14 06:09:33 -05:00
virtio-gpu.c hw/display/virtio-gpu: Protect from DMA re-entrancy bugs 2024-04-10 09:09:33 +02:00
virtio-vga-gl.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-vga-rutabaga.c gfxstream + rutabaga: add initial support for gfxstream 2023-10-16 11:29:56 +04:00
virtio-vga.c hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
virtio-vga.h hw/display/virtio-vga: Convert TYPE_VIRTIO_VGA_BASE to 3-phase reset 2022-12-16 15:59:07 +00:00
vmware_vga.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
xenfb.c xen: register legacy backends via xen_backend_init 2024-05-10 15:45:15 +02:00
xlnx_dp.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00