This commit is contained in:
dec05eba 2023-08-13 01:38:15 +02:00
parent 3131e041c1
commit a151d7ac26

View File

@ -165,12 +165,16 @@ static int gsr_capture_kms_vaapi_start(gsr_capture *cap, AVCodecContext *video_c
cap_kms->capture_pos = monitor.pos;
cap_kms->capture_size = monitor.size;
fprintf(stderr, "capture size: %d, %d\n", cap_kms->capture_size.x, cap_kms->capture_size.y);
/* Disable vsync */
cap_kms->params.egl->eglSwapInterval(cap_kms->params.egl->egl_display, 0);
video_codec_context->width = max_int(2, even_number_ceil(cap_kms->capture_size.x));
video_codec_context->height = max_int(2, even_number_ceil(cap_kms->capture_size.y));
fprintf(stderr, "video size: %d, %d\n", video_codec_context->width, video_codec_context->height);
if(!drm_create_codec_context(cap_kms, video_codec_context)) {
gsr_capture_kms_vaapi_stop(cap, video_codec_context);
return -1;
@ -246,6 +250,8 @@ static void gsr_capture_kms_vaapi_tick(gsr_capture *cap, AVCodecContext *video_c
cap_kms->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
cap_kms->params.egl->glBindTexture(GL_TEXTURE_2D, 0);
fprintf(stderr, "prime width: %u, height: %u\n", cap_kms->prime.width, cap_kms->prime.height);
if(cap_kms->prime.fourcc == FOURCC_NV12) {
cap_kms->params.egl->glGenTextures(2, cap_kms->target_textures);
for(int i = 0; i < 2; ++i) {
@ -463,6 +469,12 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
if(!capture_is_combined_plane && cursor_drm_fd && cursor_drm_fd->connector_id != drm_fd->connector_id)
cursor_drm_fd = NULL;
static bool test = true;
if(test) {
test = false;
fprintf(stderr, "drm fd: %d, %d\n", drm_fd->width, drm_fd->height);
}
// TODO: This causes a crash sometimes on steam deck, why? is it a driver bug? a vaapi pure version doesn't cause a crash.
// Even ffmpeg kmsgrab causes this crash. The error is:
// amdgpu: Failed to allocate a buffer: