mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
494154beb6
Add an implementation of GdkDmabufDownloader that uses gsk_renderer_render_texture + GL texture download. Since gsk isn't threadsafe, we do the download in the main thread, taking care to not disturb the current GL context of whatever is going on there at the time. And since gsk renderers are expensive to create, we cache it in the display. Note that gsk does not yet have any special support for dmabuf textures, so for now, they will always get downloaded and then reuploaded as GL textures.
55 lines
2.7 KiB
C
55 lines
2.7 KiB
C
#pragma once
|
|
|
|
#include "gdkdmabufformatsbuilderprivate.h"
|
|
|
|
#define GDK_DMABUF_MAX_PLANES 4
|
|
|
|
typedef struct _GdkDmabuf GdkDmabuf;
|
|
typedef struct _GdkDmabufDownloader GdkDmabufDownloader;
|
|
|
|
struct _GdkDmabuf
|
|
{
|
|
guint32 fourcc;
|
|
guint64 modifier;
|
|
unsigned int n_planes;
|
|
struct {
|
|
int fd;
|
|
unsigned int stride;
|
|
unsigned int offset;
|
|
} planes[GDK_DMABUF_MAX_PLANES];
|
|
};
|
|
|
|
struct _GdkDmabufDownloader
|
|
{
|
|
const char *name;
|
|
gboolean (* add_formats) (const GdkDmabufDownloader *downloader,
|
|
GdkDisplay *display,
|
|
GdkDmabufFormatsBuilder *builder);
|
|
gboolean (* supports) (const GdkDmabufDownloader *downloader,
|
|
GdkDisplay *display,
|
|
const GdkDmabuf *dmabuf,
|
|
gboolean premultiplied,
|
|
GdkMemoryFormat *out_format,
|
|
GError **error);
|
|
void (* download) (const GdkDmabufDownloader *downloader,
|
|
GdkTexture *texture,
|
|
GdkMemoryFormat format,
|
|
guchar *data,
|
|
gsize stride);
|
|
};
|
|
|
|
#ifdef HAVE_DMABUF
|
|
|
|
const GdkDmabufDownloader * gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST;
|
|
const GdkDmabufDownloader * gdk_dmabuf_get_egl_downloader (void) G_GNUC_CONST;
|
|
|
|
gboolean gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
|
gsize width,
|
|
gsize height,
|
|
const GdkDmabuf *src,
|
|
GError **error);
|
|
|
|
gboolean gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf);
|
|
|
|
#endif
|