[gtk/import-dmabuf: 1/3] Add an api to turn dmabufs into textures
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/import-dmabuf: 1/3] Add an api to turn dmabufs into textures
- Date: Sat, 8 May 2021 01:33:08 +0000 (UTC)
commit ad91d213c3760998b68d2b4661e602797d118cc7
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 7 21:31:03 2021 -0400
Add an api to turn dmabufs into textures
gdk/gdkglcontext.c | 18 ++++++++++++++++++
gdk/gdkglcontext.h | 9 +++++++++
gdk/gdkglcontextprivate.h | 12 ++++++++++--
3 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 7c3c0a0a79..0c41dba41c 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -1258,3 +1258,21 @@ gdk_gl_context_use_es_bgra (GdkGLContext *context)
return FALSE;
}
+
+GdkTexture *
+gdk_gl_context_import_dmabuf (GdkGLContext *context,
+ int fd,
+ int fourcc,
+ int width,
+ int height,
+ int offset,
+ int stride)
+{
+ if (GDK_GL_CONTEXT_GET_CLASS (context)->import_dmabuf)
+ return GDK_GL_CONTEXT_GET_CLASS (context)->import_dmabuf (context,
+ fd, fourcc,
+ width, height,
+ offset, stride);
+
+ return NULL;
+}
diff --git a/gdk/gdkglcontext.h b/gdk/gdkglcontext.h
index 10bac82e9b..84770cb47b 100644
--- a/gdk/gdkglcontext.h
+++ b/gdk/gdkglcontext.h
@@ -90,6 +90,15 @@ GdkGLContext * gdk_gl_context_get_current (void);
GDK_AVAILABLE_IN_ALL
void gdk_gl_context_clear_current (void);
+GDK_AVAILABLE_IN_4_4
+GdkTexture * gdk_gl_context_import_dmabuf (GdkGLContext *context,
+ int fd,
+ int fourcc,
+ int width,
+ int height,
+ int offset,
+ int stride);
+
G_END_DECLS
#endif /* __GDK_GL_CONTEXT_H__ */
diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h
index 07310eebfa..b7b4d90c07 100644
--- a/gdk/gdkglcontextprivate.h
+++ b/gdk/gdkglcontextprivate.h
@@ -45,10 +45,18 @@ struct _GdkGLContextClass
{
GdkDrawContextClass parent_class;
- gboolean (* realize) (GdkGLContext *context,
- GError **error);
+ gboolean (* realize) (GdkGLContext *context,
+ GError **error);
cairo_region_t * (* get_damage) (GdkGLContext *context);
+
+ GdkTexture * (* import_dmabuf) (GdkGLContext *context,
+ int fd,
+ int fourcc,
+ int width,
+ int height,
+ int offset,
+ int stride);
};
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]