bits, c2d.height ? res->hostmem / c2d.height : 0);
#ifdef WIN32
if (res->image) {
- pixman_image_set_destroy_function(res->image, qemu_pixman_win32_image_destroy, res->handle);
+ pixman_image_set_destroy_function(res->image, qemu_pixman_shared_image_destroy, res->handle);
}
#endif
}
return -EINVAL;
}
#ifdef WIN32
- pixman_image_set_destroy_function(res->image, qemu_pixman_win32_image_destroy, res->handle);
+ pixman_image_set_destroy_function(res->image, qemu_pixman_shared_image_destroy, res->handle);
#endif
res->addrs = g_new(uint64_t, res->iov_cnt);
void qemu_pixman_image_unref(pixman_image_t *image);
-void qemu_pixman_win32_image_destroy(pixman_image_t *image, void *data);
+void qemu_pixman_shared_image_destroy(pixman_image_t *image, void *data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(pixman_image_t, qemu_pixman_image_unref)
#ifdef WIN32
qemu_displaysurface_win32_set_handle(surface, handle, 0);
pixman_image_set_destroy_function(surface->image,
- qemu_pixman_win32_image_destroy, handle);
+ qemu_pixman_shared_image_destroy, handle);
#endif
return surface;
}
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "ui/console.h"
+#include "qemu/memfd.h"
#include "standard-headers/drm/drm_fourcc.h"
#include "trace.h"
}
#endif /* CONFIG_PIXMAN */
-#ifdef WIN32
void
-qemu_pixman_win32_image_destroy(pixman_image_t *image, void *data)
+qemu_pixman_shared_image_destroy(pixman_image_t *image, void *data)
{
+ void *ptr = pixman_image_get_data(image);
+
+#ifdef WIN32
HANDLE handle = data;
- qemu_win32_map_free(
- pixman_image_get_data(image),
- handle,
- &error_warn
- );
-}
+ qemu_win32_map_free(ptr, handle, &error_warn);
+#else
+ int shmfd = GPOINTER_TO_INT(data);
+ size_t size = pixman_image_get_height(image) * pixman_image_get_stride(image);
+
+ qemu_memfd_free(ptr, size, shmfd);
#endif
+}