Use correct offset for kms_vaapi monitor

This commit is contained in:
dec05eba 2023-09-27 00:52:28 +02:00
parent 6024beca4e
commit b6ea32330e
2 changed files with 8 additions and 4 deletions

View File

@ -372,6 +372,9 @@ static int gsr_capture_kms_cuda_capture(gsr_capture *cap, AVFrame *frame) {
} }
} }
// TODO: Use capture pos and capture size. Right now they are not used here and doesn't really need to be used on wayland
// and kms_cuda is only used on wayland right now so maybe it can be ignored.
if(!drm_fd) if(!drm_fd)
return -1; return -1;

View File

@ -448,6 +448,7 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
break; break;
} }
// Will never happen on wayland unless the target monitor has been disconnected
if(!drm_fd) { if(!drm_fd) {
drm_fd = find_first_combined_drm(&cap_kms->kms_response); drm_fd = find_first_combined_drm(&cap_kms->kms_response);
if(!drm_fd) if(!drm_fd)
@ -502,16 +503,16 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
cap_kms->params.egl->glBindTexture(GL_TEXTURE_2D, 0); cap_kms->params.egl->glBindTexture(GL_TEXTURE_2D, 0);
vec2i capture_pos = cap_kms->capture_pos; vec2i capture_pos = cap_kms->capture_pos;
if(capture_is_combined_plane) {
capture_pos = (vec2i){ 0, 0 };
}
if(cap_kms->using_wayland_capture) { if(cap_kms->using_wayland_capture) {
gsr_color_conversion_draw(&cap_kms->color_conversion, cap_kms->input_texture, gsr_color_conversion_draw(&cap_kms->color_conversion, cap_kms->input_texture,
(vec2i){0, 0}, cap_kms->capture_size, (vec2i){0, 0}, cap_kms->capture_size,
capture_pos, cap_kms->capture_size, (vec2i){0, 0}, cap_kms->capture_size,
0.0f); 0.0f);
} else { } else {
if(!capture_is_combined_plane)
capture_pos = (vec2i){drm_fd->x, drm_fd->y};
float texture_rotation = 0.0f; float texture_rotation = 0.0f;
gsr_color_conversion_draw(&cap_kms->color_conversion, cap_kms->input_texture, gsr_color_conversion_draw(&cap_kms->color_conversion, cap_kms->input_texture,