aboutsummaryrefslogtreecommitdiff
path: root/src/capture
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-03-17 17:17:14 +0100
committerdec05eba <dec05eba@protonmail.com>2023-03-17 17:17:14 +0100
commit93cb6593a642018e3373fb7099e1c0687b367176 (patch)
tree63d24dc3a9a03e71857ef793929f6000f75cc3db /src/capture
parent8cbdb596ebf79587a432ed40583630b6cd39ed88 (diff)
Add overclocking option -oc to workaround a NVIDIA driver bug (forcefully set to p2 state when using cuda)
Diffstat (limited to 'src/capture')
-rw-r--r--src/capture/nvfbc.c2
-rw-r--r--src/capture/xcomposite_cuda.c6
-rw-r--r--src/capture/xcomposite_drm.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c
index fba3321..5371d02 100644
--- a/src/capture/nvfbc.c
+++ b/src/capture/nvfbc.c
@@ -183,7 +183,7 @@ static bool ffmpeg_create_cuda_contexts(gsr_capture_nvfbc *cap_nvfbc, AVCodecCon
static int gsr_capture_nvfbc_start(gsr_capture *cap, AVCodecContext *video_codec_context) {
gsr_capture_nvfbc *cap_nvfbc = cap->priv;
- if(!gsr_cuda_load(&cap_nvfbc->cuda))
+ if(!gsr_cuda_load(&cap_nvfbc->cuda, cap_nvfbc->params.dpy, cap_nvfbc->params.overclock))
return -1;
if(!gsr_capture_nvfbc_load_library(cap)) {
diff --git a/src/capture/xcomposite_cuda.c b/src/capture/xcomposite_cuda.c
index 877206b..fd140c6 100644
--- a/src/capture/xcomposite_cuda.c
+++ b/src/capture/xcomposite_cuda.c
@@ -222,7 +222,7 @@ static int gsr_capture_xcomposite_cuda_start(gsr_capture *cap, AVCodecContext *v
return -1;
}
- if(!gsr_cuda_load(&cap_xcomp->cuda)) {
+ if(!gsr_cuda_load(&cap_xcomp->cuda, cap_xcomp->dpy, cap_xcomp->params.overclock)) {
gsr_capture_xcomposite_cuda_stop(cap, video_codec_context);
return -1;
}
@@ -269,7 +269,8 @@ static void gsr_capture_xcomposite_cuda_stop(gsr_capture *cap, AVCodecContext *v
gsr_egl_unload(&cap_xcomp->egl);
if(cap_xcomp->dpy) {
- XCloseDisplay(cap_xcomp->dpy);
+ // TODO: This causes a crash, why? maybe some other library dlclose xlib and that also happened to unload this???
+ //XCloseDisplay(cap_xcomp->dpy);
cap_xcomp->dpy = NULL;
}
}
@@ -424,6 +425,7 @@ static int gsr_capture_xcomposite_cuda_capture(gsr_capture *cap, AVFrame *frame)
vec2i source_size = cap_xcomp->texture_size;
if(cap_xcomp->window_texture.texture_id != 0) {
+ while(cap_xcomp->egl.glGetError()) {}
/* TODO: Remove this copy, which is only possible by using nvenc directly and encoding window_pixmap.target_texture_id */
cap_xcomp->egl.glCopyImageSubData(
window_texture_get_opengl_texture_id(&cap_xcomp->window_texture), GL_TEXTURE_2D, 0, source_pos.x, source_pos.y, 0,
diff --git a/src/capture/xcomposite_drm.c b/src/capture/xcomposite_drm.c
index 9fb323d..489fc45 100644
--- a/src/capture/xcomposite_drm.c
+++ b/src/capture/xcomposite_drm.c
@@ -706,6 +706,7 @@ static void gsr_capture_xcomposite_drm_tick(gsr_capture *cap, AVCodecContext *vi
#define FOURCC_NV12 842094158
if(prime.fourcc == FOURCC_NV12) { // This happens on AMD
+ while(cap_xcomp->egl.glGetError()) {}
while(cap_xcomp->egl.eglGetError() != EGL_SUCCESS){}
EGLImage images[2];
@@ -902,7 +903,8 @@ static void gsr_capture_xcomposite_drm_destroy(gsr_capture *cap, AVCodecContext
cap->priv = NULL;
}
if(cap_xcomp->dpy) {
- XCloseDisplay(cap_xcomp->dpy);
+ // TODO: This causes a crash, why? maybe some other library dlclose xlib and that also happened to unload this???
+ //XCloseDisplay(cap_xcomp->dpy);
cap_xcomp->dpy = NULL;
}
free(cap);