Hide cursor when it's on another display 2
This commit is contained in:
parent
4e8c47a154
commit
b898bddb63
@ -234,11 +234,21 @@ static bool gsr_capture_kms_cuda_should_stop(gsr_capture *cap, bool *err) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Prefer non combined planes */
|
||||
static gsr_kms_response_fd* find_drm_by_connector_id(gsr_kms_response *kms_response, uint32_t connector_id) {
|
||||
int index_combined = -1;
|
||||
for(int i = 0; i < kms_response->num_fds; ++i) {
|
||||
if(kms_response->fds[i].connector_id == connector_id && !kms_response->fds[i].is_cursor)
|
||||
if(kms_response->fds[i].connector_id == connector_id && !kms_response->fds[i].is_cursor) {
|
||||
if(kms_response->fds[i].is_combined_plane)
|
||||
index_combined = i;
|
||||
else
|
||||
return &kms_response->fds[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(index_combined != -1)
|
||||
return &kms_response->fds[index_combined];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -338,11 +338,21 @@ static bool gsr_capture_kms_vaapi_should_stop(gsr_capture *cap, bool *err) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Prefer non combined planes */
|
||||
static gsr_kms_response_fd* find_drm_by_connector_id(gsr_kms_response *kms_response, uint32_t connector_id) {
|
||||
int index_combined = -1;
|
||||
for(int i = 0; i < kms_response->num_fds; ++i) {
|
||||
if(kms_response->fds[i].connector_id == connector_id && !kms_response->fds[i].is_cursor)
|
||||
if(kms_response->fds[i].connector_id == connector_id && !kms_response->fds[i].is_cursor) {
|
||||
if(kms_response->fds[i].is_combined_plane)
|
||||
index_combined = i;
|
||||
else
|
||||
return &kms_response->fds[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(index_combined != -1)
|
||||
return &kms_response->fds[index_combined];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -453,15 +463,16 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
||||
}
|
||||
|
||||
cursor_drm_fd = find_cursor_drm(&cap_kms->kms_response);
|
||||
/* Hide cursor when it's on another display */
|
||||
if(cursor_drm_fd && drm_fd && cursor_drm_fd->connector_id != drm_fd->connector_id)
|
||||
cursor_drm_fd = NULL;
|
||||
capture_is_combined_plane = (drm_fd && drm_fd->is_combined_plane) || count_non_cursor_planes(&cap_kms->kms_response) == 1;
|
||||
}
|
||||
|
||||
if(!drm_fd)
|
||||
return -1;
|
||||
|
||||
/* Hide cursor when it's on another display */
|
||||
if(!capture_is_combined_plane && cursor_drm_fd && cursor_drm_fd->connector_id != drm_fd->connector_id)
|
||||
cursor_drm_fd = NULL;
|
||||
|
||||
// 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:
|
||||
|
Loading…
Reference in New Issue
Block a user