aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/capture/capture.h6
-rw-r--r--include/damage.h3
-rw-r--r--include/egl.h5
-rw-r--r--include/pipewire.h4
-rw-r--r--include/utils.h6
-rw-r--r--include/window_texture.h1
6 files changed, 18 insertions, 7 deletions
diff --git a/include/capture/capture.h b/include/capture/capture.h
index e31b3a5..7c8887d 100644
--- a/include/capture/capture.h
+++ b/include/capture/capture.h
@@ -17,10 +17,9 @@ struct gsr_capture {
/* These methods should not be called manually. Call gsr_capture_* instead */
int (*start)(gsr_capture *cap, AVCodecContext *video_codec_context, AVFrame *frame);
void (*on_event)(gsr_capture *cap, gsr_egl *egl); /* can be NULL */
- void (*tick)(gsr_capture *cap, AVCodecContext *video_codec_context); /* can be NULL. If there is an event then |on_event| is called before this */
+ void (*tick)(gsr_capture *cap); /* can be NULL. If there is an event then |on_event| is called before this */
bool (*should_stop)(gsr_capture *cap, bool *err); /* can be NULL. If NULL, return false */
int (*capture)(gsr_capture *cap, AVFrame *frame, gsr_color_conversion *color_conversion);
- void (*capture_end)(gsr_capture *cap, AVFrame *frame); /* can be NULL */
gsr_source_color (*get_source_color)(gsr_capture *cap);
bool (*uses_external_image)(gsr_capture *cap); /* can be NULL. If NULL, return false */
bool (*set_hdr_metadata)(gsr_capture *cap, AVMasteringDisplayMetadata *mastering_display_metadata, AVContentLightMetadata *light_metadata); /* can be NULL. If NULL, return false */
@@ -35,10 +34,9 @@ struct gsr_capture {
int gsr_capture_start(gsr_capture *cap, AVCodecContext *video_codec_context, AVFrame *frame);
void gsr_capture_on_event(gsr_capture *cap, gsr_egl *egl);
-void gsr_capture_tick(gsr_capture *cap, AVCodecContext *video_codec_context);
+void gsr_capture_tick(gsr_capture *cap);
bool gsr_capture_should_stop(gsr_capture *cap, bool *err);
int gsr_capture_capture(gsr_capture *cap, AVFrame *frame, gsr_color_conversion *color_conversion);
-void gsr_capture_capture_end(gsr_capture *cap, AVFrame *frame);
gsr_source_color gsr_capture_get_source_color(gsr_capture *cap);
bool gsr_capture_uses_external_image(gsr_capture *cap);
bool gsr_capture_set_hdr_metadata(gsr_capture *cap, AVMasteringDisplayMetadata *mastering_display_metadata, AVContentLightMetadata *light_metadata);
diff --git a/include/damage.h b/include/damage.h
index 2bf43d7..7229418 100644
--- a/include/damage.h
+++ b/include/damage.h
@@ -1,6 +1,7 @@
#ifndef GSR_DAMAGE_H
#define GSR_DAMAGE_H
+#include "cursor.h"
#include "utils.h"
#include <stdbool.h>
#include <stdint.h>
@@ -31,7 +32,7 @@ typedef struct {
//vec2i window_pos;
vec2i window_size;
- vec2i cursor_position; /* Relative to |window| */
+ gsr_cursor cursor; /* Relative to |window| */
gsr_monitor monitor;
char monitor_name[32];
} gsr_damage;
diff --git a/include/egl.h b/include/egl.h
index 61890b4..3fdbf48 100644
--- a/include/egl.h
+++ b/include/egl.h
@@ -31,6 +31,7 @@ typedef void* EGLSurface;
typedef void* EGLContext;
typedef void* EGLClientBuffer;
typedef void* EGLImage;
+typedef void* EGLImageKHR;
typedef void *GLeglImageOES;
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
typedef struct __GLXFBConfigRec *GLXFBConfig;
@@ -138,6 +139,8 @@ typedef void(*__GLXextFuncPtr)(void);
#define GL_COMPILE_STATUS 0x8B81
#define GL_LINK_STATUS 0x8B82
+typedef unsigned int (*FUNC_eglExportDMABUFImageQueryMESA)(EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, uint64_t *modifiers);
+typedef unsigned int (*FUNC_eglExportDMABUFImageMESA)(EGLDisplay dpy, EGLImageKHR image, int *fds, int32_t *strides, int32_t *offsets);
typedef void (*FUNC_glEGLImageTargetTexture2DOES)(unsigned int target, GLeglImageOES image);
typedef GLXContext (*FUNC_glXCreateContextAttribsARB)(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
typedef void (*FUNC_glXSwapIntervalEXT)(Display * dpy, GLXDrawable drawable, int interval);
@@ -235,6 +238,8 @@ struct gsr_egl {
unsigned int (*eglBindAPI)(unsigned int api);
__eglMustCastToProperFunctionPointerType (*eglGetProcAddress)(const char *procname);
+ FUNC_eglExportDMABUFImageQueryMESA eglExportDMABUFImageQueryMESA;
+ FUNC_eglExportDMABUFImageMESA eglExportDMABUFImageMESA;
FUNC_glEGLImageTargetTexture2DOES glEGLImageTargetTexture2DOES;
FUNC_eglQueryDisplayAttribEXT eglQueryDisplayAttribEXT;
FUNC_eglQueryDeviceStringEXT eglQueryDeviceStringEXT;
diff --git a/include/pipewire.h b/include/pipewire.h
index 13c4b67..1908e2d 100644
--- a/include/pipewire.h
+++ b/include/pipewire.h
@@ -104,8 +104,8 @@ typedef struct {
bool gsr_pipewire_init(gsr_pipewire *self, int pipewire_fd, uint32_t pipewire_node, int fps, bool capture_cursor, gsr_egl *egl);
void gsr_pipewire_deinit(gsr_pipewire *self);
-/* |plane_fds| should be at least GSR_PIPEWIRE_DMABUF_MAX_PLANES in size */
-bool gsr_pipewire_map_texture(gsr_pipewire *self, gsr_texture_map texture_map, gsr_pipewire_region *region, gsr_pipewire_region *cursor_region, int *plane_fds, int *num_plane_fds, bool *using_external_image);
+/* |dmabuf_data| should be at least GSR_PIPEWIRE_DMABUF_MAX_PLANES in size */
+bool gsr_pipewire_map_texture(gsr_pipewire *self, gsr_texture_map texture_map, gsr_pipewire_region *region, gsr_pipewire_region *cursor_region, gsr_pipewire_dmabuf_data *dmabuf_data, int *num_dmabuf_data, uint32_t *fourcc, uint64_t *modifiers, bool *using_external_image);
bool gsr_pipewire_is_damaged(gsr_pipewire *self);
void gsr_pipewire_clear_damage(gsr_pipewire *self);
diff --git a/include/utils.h b/include/utils.h
index 99503e2..92eb851 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -7,6 +7,9 @@
#include <stdbool.h>
#include <stdint.h>
+typedef struct AVCodecContext AVCodecContext;
+typedef struct AVFrame AVFrame;
+
typedef struct {
const char *name;
int name_len;
@@ -44,5 +47,8 @@ int create_directory_recursive(char *path);
/* |img_attr| needs to be at least 44 in size */
void setup_dma_buf_attrs(intptr_t *img_attr, uint32_t format, uint32_t width, uint32_t height, const int *fds, const uint32_t *offsets, const uint32_t *pitches, const uint64_t *modifiers, int num_planes, bool use_modifier);
+bool video_codec_context_is_vaapi(AVCodecContext *video_codec_context);
+bool vaapi_copy_drm_planes_to_video_surface(AVCodecContext *video_codec_context, AVFrame *video_frame, vec2i source_pos, vec2i source_size, vec2i dest_pos, vec2i dest_size, uint32_t format, vec2i size, const int *fds, const uint32_t *offsets, const uint32_t *pitches, const uint64_t *modifiers, int num_planes);
+bool vaapi_copy_egl_image_to_video_surface(gsr_egl *egl, EGLImage image, vec2i source_pos, vec2i source_size, vec2i dest_pos, vec2i dest_size, AVCodecContext *video_codec_context, AVFrame *video_frame);
#endif /* GSR_UTILS_H */
diff --git a/include/window_texture.h b/include/window_texture.h
index 75bb2a7..6ee5df4 100644
--- a/include/window_texture.h
+++ b/include/window_texture.h
@@ -7,6 +7,7 @@ typedef struct {
Display *display;
Window window;
Pixmap pixmap;
+ EGLImage image;
unsigned int texture_id;
int redirected;
gsr_egl *egl;