mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Init the dmabuf subsystem before creating texture See merge request GNOME/gtk!6499
This commit is contained in:
commit
677a601d11
@ -1866,12 +1866,12 @@ gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
* using the relevant EGL extensions, and download it into a memory
|
||||
* texture, possibly doing format conversion with shaders (in GSK).
|
||||
*/
|
||||
static void
|
||||
init_dmabuf_formats (GdkDisplay *display)
|
||||
void
|
||||
gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
{
|
||||
GdkDmabufFormatsBuilder *builder;
|
||||
|
||||
if (display->dmabuf_formats != NULL)
|
||||
if (self->dmabuf_formats != NULL)
|
||||
return;
|
||||
|
||||
builder = gdk_dmabuf_formats_builder_new ();
|
||||
@ -1879,13 +1879,13 @@ init_dmabuf_formats (GdkDisplay *display)
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
if (!GDK_DEBUG_CHECK (DMABUF_DISABLE))
|
||||
{
|
||||
gdk_display_prepare_gl (display, NULL);
|
||||
gdk_display_prepare_gl (self, NULL);
|
||||
|
||||
gdk_display_add_dmabuf_downloader (display, gdk_dmabuf_get_direct_downloader (), builder);
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_direct_downloader (), builder);
|
||||
}
|
||||
#endif
|
||||
|
||||
display->dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (builder);
|
||||
self->dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1904,7 +1904,7 @@ init_dmabuf_formats (GdkDisplay *display)
|
||||
GdkDmabufFormats *
|
||||
gdk_display_get_dmabuf_formats (GdkDisplay *display)
|
||||
{
|
||||
init_dmabuf_formats (display);
|
||||
gdk_display_init_dmabuf (display);
|
||||
|
||||
return display->dmabuf_formats;
|
||||
}
|
||||
|
@ -211,6 +211,8 @@ gulong _gdk_display_get_next_serial (GdkDisplay *display
|
||||
void _gdk_display_pause_events (GdkDisplay *display);
|
||||
void _gdk_display_unpause_events (GdkDisplay *display);
|
||||
|
||||
void gdk_display_init_dmabuf (GdkDisplay *self);
|
||||
|
||||
GdkVulkanContext * gdk_display_create_vulkan_context (GdkDisplay *self,
|
||||
GError **error);
|
||||
|
||||
|
@ -140,6 +140,8 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
display = gdk_dmabuf_texture_builder_get_display (builder);
|
||||
dmabuf = gdk_dmabuf_texture_builder_get_dmabuf (builder);
|
||||
|
||||
gdk_display_init_dmabuf (display);
|
||||
|
||||
for (i = 0; display->dmabuf_downloaders[i] != NULL; i++)
|
||||
{
|
||||
if (local_error && g_error_matches (local_error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT))
|
||||
|
@ -365,6 +365,8 @@ static void
|
||||
gdk_dmabuf_texture_builder_init (GdkDmabufTextureBuilder *self)
|
||||
{
|
||||
self->premultiplied = TRUE;
|
||||
self->display = gdk_display_get_default ();
|
||||
|
||||
for (int i = 0; i < GDK_DMABUF_MAX_PLANES; i++)
|
||||
self->dmabuf.planes[i].fd = -1;
|
||||
}
|
||||
@ -391,7 +393,7 @@ gdk_dmabuf_texture_builder_new (void)
|
||||
* Returns the display that this texture builder is
|
||||
* associated with.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the display
|
||||
* Returns: (transfer none): the display
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@ -421,6 +423,7 @@ gdk_dmabuf_texture_builder_set_display (GdkDmabufTextureBuilder *self,
|
||||
GdkDisplay *display)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DMABUF_TEXTURE_BUILDER (self));
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
if (g_set_object (&self->display, display))
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DISPLAY]);
|
||||
|
@ -182,6 +182,10 @@ test_type (gconstpointer data)
|
||||
strcmp (pspec->name, "storable-formats") == 0)
|
||||
check = FALSE;
|
||||
|
||||
if (g_type_is_a (type, GDK_TYPE_DMABUF_TEXTURE_BUILDER) &&
|
||||
strcmp (pspec->name, "display") == 0)
|
||||
check = FALSE;
|
||||
|
||||
/* set in the constructor */
|
||||
if (g_type_is_a (type, GSK_TYPE_GL_SHADER) &&
|
||||
strcmp (pspec->name, "source") == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user