kms: fix multi monitor coordinate being incorrect in some cases
This commit is contained in:
parent
95290bc031
commit
b290f76372
@ -461,9 +461,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool requires_rotation = cap_kms->requires_rotation;
|
|
||||||
bool capture_is_combined_plane = false;
|
|
||||||
|
|
||||||
gsr_kms_response_fd *drm_fd = NULL;
|
gsr_kms_response_fd *drm_fd = NULL;
|
||||||
if(cap_kms->screen_capture) {
|
if(cap_kms->screen_capture) {
|
||||||
drm_fd = find_first_combined_drm(&cap_kms->kms_response);
|
drm_fd = find_first_combined_drm(&cap_kms->kms_response);
|
||||||
@ -472,11 +469,9 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
|||||||
} else {
|
} else {
|
||||||
for(int i = 0; i < cap_kms->monitor_id.num_connector_ids; ++i) {
|
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]);
|
drm_fd = find_drm_by_connector_id(&cap_kms->kms_response, cap_kms->monitor_id.connector_ids[i]);
|
||||||
if(drm_fd) {
|
if(drm_fd)
|
||||||
requires_rotation = cap_kms->x11_rot != X11_ROT_0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
@ -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.
|
// 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:
|
// 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 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};
|
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) {
|
if(!capture_is_combined_plane) {
|
||||||
fprintf(stderr, "plane not combined\n");
|
|
||||||
capture_pos = (vec2i){0, 0};
|
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};
|
//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,
|
gsr_color_conversion_draw(&cap_kms->color_conversion, cap_kms->input_texture,
|
||||||
|
Loading…
Reference in New Issue
Block a user