vulkan: Allow specifying color state for dmabufs
When createing dmabuf textures, allow specifying a color state.
This commit is contained in:
@@ -143,7 +143,7 @@ gsk_gpu_download_op_vk_command (GskGpuOp *op,
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
if (self->allow_dmabuf)
|
||||
self->texture = gsk_vulkan_image_to_dmabuf_texture (GSK_VULKAN_IMAGE (self->image));
|
||||
self->texture = gsk_vulkan_image_to_dmabuf_texture (GSK_VULKAN_IMAGE (self->image), NULL);
|
||||
if (self->texture)
|
||||
{
|
||||
GskGpuDevice *device = gsk_gpu_frame_get_device (frame);
|
||||
|
||||
@@ -1176,7 +1176,8 @@ gsk_vulkan_image_get_n_planes (GskVulkanImage *self,
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gsk_vulkan_image_to_dmabuf_texture (GskVulkanImage *self)
|
||||
gsk_vulkan_image_to_dmabuf_texture (GskVulkanImage *self,
|
||||
GdkColorState *color_state)
|
||||
{
|
||||
GskGpuImage *image = GSK_GPU_IMAGE (self);
|
||||
GdkDmabufTextureBuilder *builder;
|
||||
@@ -1230,7 +1231,7 @@ gsk_vulkan_image_to_dmabuf_texture (GskVulkanImage *self)
|
||||
gdk_dmabuf_texture_builder_set_modifier (builder, properties.drmFormatModifier);
|
||||
gdk_dmabuf_texture_builder_set_premultiplied (builder, !(gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_STRAIGHT_ALPHA));
|
||||
gdk_dmabuf_texture_builder_set_n_planes (builder, n_planes);
|
||||
|
||||
|
||||
for (plane = 0; plane < n_planes; plane++)
|
||||
{
|
||||
static const VkImageAspectFlagBits aspect[GDK_DMABUF_MAX_PLANES] = {
|
||||
@@ -1252,6 +1253,9 @@ gsk_vulkan_image_to_dmabuf_texture (GskVulkanImage *self)
|
||||
gdk_dmabuf_texture_builder_set_offset (builder, plane, layout.offset);
|
||||
}
|
||||
|
||||
if (color_state)
|
||||
gdk_dmabuf_texture_builder_set_color_state (builder, color_state);
|
||||
|
||||
texture = gdk_dmabuf_texture_builder_build (builder, close_the_fd, GINT_TO_POINTER (fd), &error);
|
||||
g_object_unref (builder);
|
||||
if (texture == NULL)
|
||||
|
||||
@@ -44,7 +44,8 @@ GskGpuImage * gsk_vulkan_image_new_for_dmabuf (GskVulk
|
||||
gsize height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean premultiplied);
|
||||
GdkTexture * gsk_vulkan_image_to_dmabuf_texture (GskVulkanImage *self);
|
||||
GdkTexture * gsk_vulkan_image_to_dmabuf_texture (GskVulkanImage *self,
|
||||
GdkColorState *color_state);
|
||||
#endif
|
||||
|
||||
guchar * gsk_vulkan_image_get_data (GskVulkanImage *self,
|
||||
|
||||
Reference in New Issue
Block a user