mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Remove swap buffer call
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
20
src/egl.c
20
src/egl.c
@@ -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);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
14
src/utils.c
14
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];
|
||||
|
||||
Reference in New Issue
Block a user