diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-06-10 01:39:58 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-06-10 01:39:58 +0200 |
commit | b290f76372a9d00c4762fb110ad6abb5bb3ec230 (patch) | |
tree | 9ae35b47d2c4c945a4dd4d2582cbbad2cd106838 /src/capture | |
parent | 95290bc031c08c8e8d8823e6861a70e079ac0d5c (diff) |
kms: fix multi monitor coordinate being incorrect in some cases
Diffstat (limited to 'src/capture')
-rw-r--r-- | src/capture/kms_vaapi.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/capture/kms_vaapi.c b/src/capture/kms_vaapi.c index 15c45d9..a6fae31 100644 --- a/src/capture/kms_vaapi.c +++ b/src/capture/kms_vaapi.c @@ -461,9 +461,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) { return -1; } - bool requires_rotation = cap_kms->requires_rotation; - bool capture_is_combined_plane = false; - gsr_kms_response_fd *drm_fd = NULL; if(cap_kms->screen_capture) { drm_fd = find_first_combined_drm(&cap_kms->kms_response); @@ -472,10 +469,8 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) { } else { for(int i = 0; i < cap_kms->monitor_id.num_connector_ids; ++i) { drm_fd = find_drm_by_connector_id(&cap_kms->kms_response, cap_kms->monitor_id.connector_ids[i]); - if(drm_fd) { - requires_rotation = cap_kms->x11_rot != X11_ROT_0; + if(drm_fd) break; - } } if(!drm_fd) { @@ -485,7 +480,10 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) { } } - capture_is_combined_plane = drm_fd->is_combined_plane || ((int)drm_fd->width == cap_kms->screen_size.x && (int)drm_fd->height == cap_kms->screen_size.y); + bool capture_is_combined_plane = drm_fd->is_combined_plane || ((int)drm_fd->width == cap_kms->screen_size.x && (int)drm_fd->height == cap_kms->screen_size.y); + bool requires_rotation = cap_kms->requires_rotation; + if(!capture_is_combined_plane && !cap_kms->screen_capture) + requires_rotation |= (cap_kms->x11_rot != X11_ROT_0); // 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: @@ -545,11 +543,8 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) { vec2i capture_size = cap_kms->capture_size; vec2i cursor_capture_pos = (vec2i){cap_kms->cursor.position.x - cap_kms->cursor.hotspot.x - capture_pos.x, cap_kms->cursor.position.y - cap_kms->cursor.hotspot.y - capture_pos.y}; if(!capture_is_combined_plane) { - fprintf(stderr, "plane not combined\n"); capture_pos = (vec2i){0, 0}; //cursor_capture_pos = (vec2i){cap_kms->cursor.position.x - cap_kms->cursor.hotspot.x, cap_kms->cursor.position.y - cap_kms->cursor.hotspot.y}; - } else { - fprintf(stderr, "plane combined\n"); } gsr_color_conversion_draw(&cap_kms->color_conversion, cap_kms->input_texture, |