mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
dmabuf: Allow downloaders to fail initialization
When adding the formats of a downloader, allow them to return FALSE to mean "This method is not supported", which is a useful way to opt out when checking GL or Vulkan extensions and finding out that the desired one isn't supported.
This commit is contained in:
parent
0817dfe67f
commit
13848969f4
@ -1847,7 +1847,8 @@ gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
{
|
||||
gsize i;
|
||||
|
||||
downloader->add_formats (downloader, display, builder);
|
||||
if (!downloader->add_formats (downloader, display, builder))
|
||||
return;
|
||||
|
||||
/* dmabuf_downloaders is NULL-terminated */
|
||||
for (i = 0; i < G_N_ELEMENTS (display->dmabuf_downloaders) - 1; i++)
|
||||
|
@ -264,7 +264,7 @@ get_drm_format_info (guint32 fourcc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gdk_dmabuf_direct_downloader_add_formats (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
@ -277,6 +277,8 @@ gdk_dmabuf_direct_downloader_add_formats (const GdkDmabufDownloader *downloader,
|
||||
supported_formats[i].fourcc,
|
||||
DRM_FORMAT_MOD_LINEAR);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -22,7 +22,7 @@ struct _GdkDmabuf
|
||||
struct _GdkDmabufDownloader
|
||||
{
|
||||
const char *name;
|
||||
void (* add_formats) (const GdkDmabufDownloader *downloader,
|
||||
gboolean (* add_formats) (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user