diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/args_parser.c | 2 | ||||
-rw-r--r-- | src/color_conversion.c | 1 | ||||
-rw-r--r-- | src/egl.c | 20 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/utils.c | 14 |
5 files changed, 21 insertions, 17 deletions
diff --git a/src/args_parser.c b/src/args_parser.c index 13b3f08..0e05557 100644 --- a/src/args_parser.c +++ b/src/args_parser.c @@ -194,7 +194,6 @@ static void usage_header() { fflush(stdout); } -// TODO: Update with portal info static void usage_full() { const bool inside_flatpak = getenv("FLATPAK_ID") != NULL; const char *program_name = inside_flatpak ? "flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder" : "gpu-screen-recorder"; @@ -397,6 +396,7 @@ static void usage_full() { printf("EXAMPLES:\n"); printf(" %s -w screen -f 60 -a default_output -o video.mp4\n", program_name); printf(" %s -w screen -f 60 -a default_output -a default_input -o video.mp4\n", program_name); + printf(" %s -w $(xdotool selectwindow) -f 60 -a default_output -o video.mp4\n", program_name); printf(" %s -w screen -f 60 -a \"default_output|default_input\" -o video.mp4\n", program_name); printf(" %s -w screen -f 60 -a default_output -c mkv -r 60 -o \"$HOME/Videos\"\n", program_name); printf(" %s -w screen -f 60 -a default_output -c mkv -r 1800 -replay-storage disk -bm cbr -q 40000 -o \"$HOME/Videos\"\n", program_name); diff --git a/src/color_conversion.c b/src/color_conversion.c index 88dc398..858990c 100644 --- a/src/color_conversion.c +++ b/src/color_conversion.c @@ -961,6 +961,7 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_ gsr_color_conversion_swizzle_reset(self, source_color); self->params.egl->glBindTexture(texture_target, 0); + self->params.egl->glFlush(); } void gsr_color_conversion_clear(gsr_color_conversion *self) { @@ -42,7 +42,7 @@ static void reset_cap_nice(void) { cap_flag_value_t cap_sys_nice_value = CAP_CLEAR; cap_get_flag(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &cap_sys_nice_value); if(cap_sys_nice_value == CAP_CLEAR) { - fprintf(stderr, "gsr warning: cap_sys_nice capability is missing on the gpu-screen-recorder binary, performance might be affected. If you are using the flatpak version of gpu-screen-recorder then the only fix is to use a non-flatpak version of gpu-screen-recorder\n"); + fprintf(stderr, "gsr warning: cap_sys_nice capability is missing on the gpu-screen-recorder binary, performance might be affected. If you are using the flatpak version of gpu-screen-recorder then the only fix is to use a non-flatpak version of gpu-screen-recorder. Make sure you install gpu-screen-recorder, don't run it from the build directory\n"); } const cap_value_t cap_to_remove = CAP_SYS_NICE; @@ -546,13 +546,13 @@ void gsr_egl_unload(gsr_egl *self) { void gsr_egl_swap_buffers(gsr_egl *self) { /* This uses less cpu than swap buffer on nvidia */ // TODO: Do these and remove swap - //self->glFlush(); - //self->glFinish(); - if(self->egl_display) { - self->eglSwapBuffers(self->egl_display, self->egl_surface); - } else if(gsr_window_get_display_server(self->window) == GSR_DISPLAY_SERVER_X11) { - Display *display = gsr_window_get_display(self->window); - const Window window = (Window)gsr_window_get_window(self->window); - self->glXSwapBuffers(display, window); - } + self->glFlush(); +// self->glFinish(); + // if(self->egl_display) { + // self->eglSwapBuffers(self->egl_display, self->egl_surface); + // } else if(gsr_window_get_display_server(self->window) == GSR_DISPLAY_SERVER_X11) { + // Display *display = gsr_window_get_display(self->window); + // const Window window = (Window)gsr_window_get_window(self->window); + // self->glXSwapBuffers(display, window); + // } } diff --git a/src/main.cpp b/src/main.cpp index 698c230..0956d0a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,6 +47,7 @@ extern "C" { extern "C" { #include <libavutil/pixfmt.h> #include <libavcodec/avcodec.h> +#include <libavcodec/defs.h> #include <libavformat/avformat.h> #include <libavutil/opt.h> #include <libswresample/swresample.h> diff --git a/src/utils.c b/src/utils.c index 27116a0..c625ecf 100644 --- a/src/utils.c +++ b/src/utils.c @@ -19,6 +19,8 @@ #include <libavcodec/avcodec.h> #include <libavutil/hwcontext_vaapi.h> +#define DRM_NUM_BUF_ATTRS 4 + double clock_get_monotonic_seconds(void) { struct timespec ts; ts.tv_sec = 0; @@ -508,35 +510,35 @@ int create_directory_recursive(char *path) { } 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) { - const uint32_t plane_fd_attrs[4] = { + const uint32_t plane_fd_attrs[DRM_NUM_BUF_ATTRS] = { EGL_DMA_BUF_PLANE0_FD_EXT, EGL_DMA_BUF_PLANE1_FD_EXT, EGL_DMA_BUF_PLANE2_FD_EXT, EGL_DMA_BUF_PLANE3_FD_EXT }; - const uint32_t plane_offset_attrs[4] = { + const uint32_t plane_offset_attrs[DRM_NUM_BUF_ATTRS] = { EGL_DMA_BUF_PLANE0_OFFSET_EXT, EGL_DMA_BUF_PLANE1_OFFSET_EXT, EGL_DMA_BUF_PLANE2_OFFSET_EXT, EGL_DMA_BUF_PLANE3_OFFSET_EXT }; - const uint32_t plane_pitch_attrs[4] = { + const uint32_t plane_pitch_attrs[DRM_NUM_BUF_ATTRS] = { EGL_DMA_BUF_PLANE0_PITCH_EXT, EGL_DMA_BUF_PLANE1_PITCH_EXT, EGL_DMA_BUF_PLANE2_PITCH_EXT, EGL_DMA_BUF_PLANE3_PITCH_EXT }; - const uint32_t plane_modifier_lo_attrs[4] = { + const uint32_t plane_modifier_lo_attrs[DRM_NUM_BUF_ATTRS] = { EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT }; - const uint32_t plane_modifier_hi_attrs[4] = { + const uint32_t plane_modifier_hi_attrs[DRM_NUM_BUF_ATTRS] = { EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, @@ -554,7 +556,7 @@ void setup_dma_buf_attrs(intptr_t *img_attr, uint32_t format, uint32_t width, ui img_attr[img_attr_index++] = EGL_HEIGHT; img_attr[img_attr_index++] = height; - assert(num_planes <= 4); + assert(num_planes <= DRM_NUM_BUF_ATTRS); for(int i = 0; i < num_planes; ++i) { img_attr[img_attr_index++] = plane_fd_attrs[i]; img_attr[img_attr_index++] = fds[i]; |