diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-03-13 22:34:29 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-03-13 22:34:29 +0100 |
commit | b0de8588f2f4a5204e9bc22218eed884fa741153 (patch) | |
tree | 6089c4688e9e65ce1f0d1ac3ee9709a020e0d942 /include | |
parent | f63409bdd758b80f3a4e414fd5cb5526e384c93a (diff) |
Take screenshot with XGetImage on x11 to workaround nvidia driver (nvfbc) limitation that only allows one nvfbc session at a time
Diffstat (limited to 'include')
-rw-r--r-- | include/capture/kms.h | 4 | ||||
-rw-r--r-- | include/capture/nvfbc.h | 2 | ||||
-rw-r--r-- | include/capture/portal.h | 2 | ||||
-rw-r--r-- | include/capture/xcomposite.h | 2 | ||||
-rw-r--r-- | include/capture/ximage.h | 18 | ||||
-rw-r--r-- | include/egl.h | 1 | ||||
-rw-r--r-- | include/image_writer.h | 8 | ||||
-rw-r--r-- | include/utils.h | 2 |
8 files changed, 28 insertions, 11 deletions
diff --git a/include/capture/kms.h b/include/capture/kms.h index f359783..ce09817 100644 --- a/include/capture/kms.h +++ b/include/capture/kms.h @@ -5,9 +5,7 @@ typedef struct { gsr_egl *egl; - const char *display_to_capture; /* if this is "screen", then the first monitor is captured. A copy is made of this */ - gsr_color_depth color_depth; - gsr_color_range color_range; + const char *display_to_capture; /* A copy is made of this */ bool hdr; bool record_cursor; int fps; diff --git a/include/capture/nvfbc.h b/include/capture/nvfbc.h index f93fdc0..07cc42f 100644 --- a/include/capture/nvfbc.h +++ b/include/capture/nvfbc.h @@ -11,8 +11,6 @@ typedef struct { vec2i pos; vec2i size; bool direct_capture; - gsr_color_depth color_depth; - gsr_color_range color_range; bool record_cursor; vec2i output_resolution; vec2i region_size; diff --git a/include/capture/portal.h b/include/capture/portal.h index 3989b98..74cdba9 100644 --- a/include/capture/portal.h +++ b/include/capture/portal.h @@ -5,8 +5,6 @@ typedef struct { gsr_egl *egl; - gsr_color_depth color_depth; - gsr_color_range color_range; bool record_cursor; bool restore_portal_session; /* If this is set to NULL then this defaults to $XDG_CONFIG_HOME/gpu-screen-recorder/restore_token ($XDG_CONFIG_HOME defaults to $HOME/.config) */ diff --git a/include/capture/xcomposite.h b/include/capture/xcomposite.h index 45eb481..bf6532e 100644 --- a/include/capture/xcomposite.h +++ b/include/capture/xcomposite.h @@ -8,9 +8,7 @@ typedef struct { gsr_egl *egl; unsigned long window; bool follow_focused; /* If this is set then |window| is ignored */ - gsr_color_range color_range; bool record_cursor; - gsr_color_depth color_depth; vec2i output_resolution; } gsr_capture_xcomposite_params; diff --git a/include/capture/ximage.h b/include/capture/ximage.h new file mode 100644 index 0000000..e6c3607 --- /dev/null +++ b/include/capture/ximage.h @@ -0,0 +1,18 @@ +#ifndef GSR_CAPTURE_XIMAGE_H +#define GSR_CAPTURE_XIMAGE_H + +#include "capture.h" +#include "../vec2.h" + +typedef struct { + gsr_egl *egl; + const char *display_to_capture; /* A copy is made of this */ + bool record_cursor; + vec2i output_resolution; + vec2i region_size; + vec2i region_position; +} gsr_capture_ximage_params; + +gsr_capture* gsr_capture_ximage_create(const gsr_capture_ximage_params *params); + +#endif /* GSR_CAPTURE_XIMAGE_H */ diff --git a/include/egl.h b/include/egl.h index 8caf89a..0d08270 100644 --- a/include/egl.h +++ b/include/egl.h @@ -235,6 +235,7 @@ struct gsr_egl { void (*glTexParameteriv)(unsigned int target, unsigned int pname, const int *params); void (*glGetTexLevelParameteriv)(unsigned int target, int level, unsigned int pname, int *params); void (*glTexImage2D)(unsigned int target, int level, int internalFormat, int width, int height, int border, unsigned int format, unsigned int type, const void *pixels); + void (*glTexSubImage2D)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, const void *pixels); void (*glGetTexImage)(unsigned int target, int level, unsigned int format, unsigned int type, void *pixels); void (*glGenFramebuffers)(int n, unsigned int *framebuffers); void (*glBindFramebuffer)(unsigned int target, unsigned int framebuffer); diff --git a/include/image_writer.h b/include/image_writer.h index 79f549e..400edd0 100644 --- a/include/image_writer.h +++ b/include/image_writer.h @@ -11,7 +11,8 @@ typedef enum { } gsr_image_format; typedef enum { - GSR_IMAGE_WRITER_SOURCE_OPENGL + GSR_IMAGE_WRITER_SOURCE_OPENGL, + GSR_IMAGE_WRITER_SOURCE_MEMORY } gsr_image_writer_source; typedef struct { @@ -20,9 +21,12 @@ typedef struct { int width; int height; unsigned int texture; + const void *memory; /* Reference */ } gsr_image_writer; -bool gsr_image_writer_init(gsr_image_writer *self, gsr_image_writer_source source, gsr_egl *egl, int width, int height); +bool gsr_image_writer_init_opengl(gsr_image_writer *self, gsr_egl *egl, int width, int height); +/* |memory| is taken as a reference */ +bool gsr_image_writer_init_memory(gsr_image_writer *self, const void *memory, int width, int height); void gsr_image_writer_deinit(gsr_image_writer *self); /* Quality is between 1 and 100 where 100 is the max quality. Quality doesn't apply to lossless formats */ diff --git a/include/utils.h b/include/utils.h index 22bc4cf..fd340e8 100644 --- a/include/utils.h +++ b/include/utils.h @@ -69,4 +69,6 @@ bool vaapi_copy_egl_image_to_video_surface(gsr_egl *egl, EGLImage image, vec2i s vec2i scale_keep_aspect_ratio(vec2i from, vec2i to); +unsigned int gl_create_texture(gsr_egl *egl, int width, int height, int internal_format, unsigned int format, int filter); + #endif /* GSR_UTILS_H */ |