mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
gpu: Add a boolean flag allow_dmabuf to the downloadop
It can be set to force the downloadop to not create dmabuf textures.
This commit is contained in:
parent
cf9b8231bd
commit
41d80ac277
@ -28,6 +28,7 @@ struct _GskGpuDownloadOp
|
|||||||
GskGpuOp op;
|
GskGpuOp op;
|
||||||
|
|
||||||
GskGpuImage *image;
|
GskGpuImage *image;
|
||||||
|
gboolean allow_dmabuf;
|
||||||
GdkGpuDownloadOpCreateFunc create_func;
|
GdkGpuDownloadOpCreateFunc create_func;
|
||||||
GskGpuDownloadFunc func;
|
GskGpuDownloadFunc func;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
@ -134,7 +135,8 @@ gsk_gpu_download_op_vk_command (GskGpuOp *op,
|
|||||||
gsize width, height, stride;
|
gsize width, height, stride;
|
||||||
|
|
||||||
#ifdef HAVE_DMABUF
|
#ifdef HAVE_DMABUF
|
||||||
self->texture = gsk_vulkan_image_to_dmabuf_texture (GSK_VULKAN_IMAGE (self->image));
|
if (self->allow_dmabuf)
|
||||||
|
self->texture = gsk_vulkan_image_to_dmabuf_texture (GSK_VULKAN_IMAGE (self->image));
|
||||||
if (self->texture)
|
if (self->texture)
|
||||||
{
|
{
|
||||||
GskVulkanDevice *device = GSK_VULKAN_DEVICE (gsk_gpu_frame_get_device (frame));
|
GskVulkanDevice *device = GSK_VULKAN_DEVICE (gsk_gpu_frame_get_device (frame));
|
||||||
@ -301,6 +303,7 @@ static const GskGpuOpClass GSK_GPU_DOWNLOAD_OP_CLASS = {
|
|||||||
void
|
void
|
||||||
gsk_gpu_download_op (GskGpuFrame *frame,
|
gsk_gpu_download_op (GskGpuFrame *frame,
|
||||||
GskGpuImage *image,
|
GskGpuImage *image,
|
||||||
|
gboolean allow_dmabuf,
|
||||||
GskGpuDownloadFunc func,
|
GskGpuDownloadFunc func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -309,6 +312,7 @@ gsk_gpu_download_op (GskGpuFrame *frame,
|
|||||||
self = (GskGpuDownloadOp *) gsk_gpu_op_alloc (frame, &GSK_GPU_DOWNLOAD_OP_CLASS);
|
self = (GskGpuDownloadOp *) gsk_gpu_op_alloc (frame, &GSK_GPU_DOWNLOAD_OP_CLASS);
|
||||||
|
|
||||||
self->image = g_object_ref (image);
|
self->image = g_object_ref (image);
|
||||||
|
self->allow_dmabuf = allow_dmabuf;
|
||||||
self->func = func,
|
self->func = func,
|
||||||
self->user_data = user_data;
|
self->user_data = user_data;
|
||||||
}
|
}
|
||||||
@ -337,6 +341,7 @@ gsk_gpu_download_png_op (GskGpuFrame *frame,
|
|||||||
|
|
||||||
gsk_gpu_download_op (frame,
|
gsk_gpu_download_op (frame,
|
||||||
image,
|
image,
|
||||||
|
FALSE,
|
||||||
gsk_gpu_download_save_png_cb,
|
gsk_gpu_download_save_png_cb,
|
||||||
filename);
|
filename);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ typedef void (* GskGpuDownloadFunc) (gpointe
|
|||||||
|
|
||||||
void gsk_gpu_download_op (GskGpuFrame *frame,
|
void gsk_gpu_download_op (GskGpuFrame *frame,
|
||||||
GskGpuImage *image,
|
GskGpuImage *image,
|
||||||
|
gboolean allow_dmabuf,
|
||||||
GskGpuDownloadFunc func,
|
GskGpuDownloadFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ gsk_gpu_frame_record (GskGpuFrame *self,
|
|||||||
GSK_RENDER_PASS_PRESENT);
|
GSK_RENDER_PASS_PRESENT);
|
||||||
|
|
||||||
if (texture)
|
if (texture)
|
||||||
gsk_gpu_download_op (self, target, copy_texture, texture);
|
gsk_gpu_download_op (self, target, TRUE, copy_texture, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user