aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/egl.h3
-rw-r--r--include/vaapi.h63
2 files changed, 66 insertions, 0 deletions
diff --git a/include/egl.h b/include/egl.h
index 6e8f763..f4c47ff 100644
--- a/include/egl.h
+++ b/include/egl.h
@@ -33,12 +33,14 @@ typedef void* EGLImageKHR;
typedef void *GLeglImageOES;
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_SUCCESS 0x3000
#define EGL_BUFFER_SIZE 0x3020
#define EGL_RENDERABLE_TYPE 0x3040
#define EGL_OPENGL_ES2_BIT 0x0004
#define EGL_NONE 0x3038
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_BACK_BUFFER 0x3084
+#define EGL_GL_TEXTURE_2D 0x30B1
#define GL_TEXTURE_2D 0x0DE1
#define GL_RGB 0x1907
@@ -97,6 +99,7 @@ typedef struct {
EGLContext egl_context;
Window window;
+ int32_t (*eglGetError)(void);
EGLDisplay (*eglGetDisplay)(EGLNativeDisplayType display_id);
unsigned int (*eglInitialize)(EGLDisplay dpy, int32_t *major, int32_t *minor);
unsigned int (*eglTerminate)(EGLDisplay dpy);
diff --git a/include/vaapi.h b/include/vaapi.h
new file mode 100644
index 0000000..7ec73b2
--- /dev/null
+++ b/include/vaapi.h
@@ -0,0 +1,63 @@
+#ifndef GSR_VAAPI_H
+#define GSR_VAAPI_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+typedef void* VADisplay;
+typedef int VAStatus;
+typedef unsigned int VAGenericID;
+typedef VAGenericID VASurfaceID;
+
+typedef struct {
+ /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
+ uint32_t fourcc;
+ /** Width of the surface in pixels. */
+ uint32_t width;
+ /** Height of the surface in pixels. */
+ uint32_t height;
+ /** Number of distinct DRM objects making up the surface. */
+ uint32_t num_objects;
+ /** Description of each object. */
+ struct {
+ /** DRM PRIME file descriptor for this object. */
+ int fd;
+ /** Total size of this object (may include regions which are
+ * not part of the surface). */
+ uint32_t size;
+ /** Format modifier applied to this object. */
+ uint64_t drm_format_modifier;
+ } objects[4];
+ /** Number of layers making up the surface. */
+ uint32_t num_layers;
+ /** Description of each layer in the surface. */
+ struct {
+ /** DRM format fourcc of this layer (DRM_FOURCC_*). */
+ uint32_t drm_format;
+ /** Number of planes in this layer. */
+ uint32_t num_planes;
+ /** Index in the objects array of the object containing each
+ * plane. */
+ uint32_t object_index[4];
+ /** Offset within the object of each plane. */
+ uint32_t offset[4];
+ /** Pitch of each plane. */
+ uint32_t pitch[4];
+ } layers[4];
+} VADRMPRIMESurfaceDescriptor;
+
+#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000
+#define VA_EXPORT_SURFACE_READ_WRITE 0x0003
+#define VA_EXPORT_SURFACE_SEPARATE_LAYERS 0x0004
+
+typedef struct {
+ void *library;
+
+ VAStatus (*vaExportSurfaceHandle)(VADisplay dpy, VASurfaceID surface_id, uint32_t mem_type, uint32_t flags, void *descriptor);
+ VAStatus (*vaSyncSurface)(VADisplay dpy, VASurfaceID render_target);
+} gsr_vaapi;
+
+bool gsr_vaapi_load(gsr_vaapi *self);
+void gsr_vaapi_unload(gsr_vaapi *self);
+
+#endif /* GSR_VAAPI_H */