refine cursor capture
This commit is contained in:
parent
daf3db0b19
commit
2fd00d80b2
2 changed files with 15 additions and 4 deletions
17
drm.c
17
drm.c
|
@ -251,6 +251,10 @@ static int drm_refresh_planes(char first_time) {
|
|||
}
|
||||
if (!drm->plane || (kmsvnc->capture_cursor && !drm->cursor_plane)) {
|
||||
drmModePlane *current_plane = NULL;
|
||||
if (drm->plane_res) {
|
||||
drmModeFreePlaneResources(kmsvnc->drm->plane_res);
|
||||
drm->plane_res = NULL;
|
||||
}
|
||||
drm->plane_res = drmModeGetPlaneResources(drm->drm_fd);
|
||||
if (!drm->plane_res)
|
||||
KMSVNC_FATAL("Failed to get plane resources: %s\n", strerror(errno));
|
||||
|
@ -336,11 +340,18 @@ static int drm_refresh_planes(char first_time) {
|
|||
int drm_dump_cursor_plane(char **data, int *width, int *height) {
|
||||
struct kmsvnc_drm_data *drm = kmsvnc->drm;
|
||||
|
||||
if (drm->cursor_plane) {
|
||||
if (!drm->cursor_plane) {
|
||||
drm_refresh_planes(0); // ignore error
|
||||
if (drm->cursor_plane) {
|
||||
printf("Using cursor plane %u\n", drm->cursor_plane->plane_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint32_t plane_id = drm->cursor_plane->plane_id;
|
||||
drmModeFreePlane(drm->cursor_plane);
|
||||
drm->cursor_plane = NULL;
|
||||
drm->cursor_plane = drmModeGetPlane(drm->drm_fd, plane_id);
|
||||
}
|
||||
drm_refresh_planes(0); // ignore error
|
||||
if (!drm->cursor_plane) {
|
||||
data = NULL;
|
||||
return 1;
|
||||
|
@ -351,7 +362,7 @@ int drm_dump_cursor_plane(char **data, int *width, int *height) {
|
|||
KMSVNC_DEBUG("Cursor framebuffer missing\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (drm->cursor_mfb->modifier != DRM_FORMAT_MOD_NONE && drm->cursor_mfb->modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||
//kmsvnc->capture_cursor = 0;
|
||||
KMSVNC_DEBUG("Cursor plane modifier is not linear: %lu\n", drm->cursor_mfb->modifier);
|
||||
|
|
2
kmsvnc.c
2
kmsvnc.c
|
@ -230,7 +230,7 @@ static struct argp_option kmsvnc_main_options[] = {
|
|||
{"fps", 0xff00, "30", 0, "Target frames per second"},
|
||||
{"disable-always-shared", 0xff01, 0, OPTION_ARG_OPTIONAL, "Do not always treat incoming connections as shared"},
|
||||
{"disable-compare-fb", 0xff02, 0, OPTION_ARG_OPTIONAL, "Do not compare pixels"},
|
||||
{"capture-cursor", 'c', 0, OPTION_ARG_OPTIONAL, "Do not capture cursor fb"},
|
||||
{"capture-cursor", 'c', 0, OPTION_ARG_OPTIONAL, "Capture mouse cursor"},
|
||||
{"capture-raw-fb", 0xff03, "/tmp/rawfb.bin", 0, "Capture RAW framebuffer instead of starting the vnc server (for debugging)"},
|
||||
{"va-derive", 0xff04, "off", 0, "Enable derive with vaapi"},
|
||||
{"debug", 0xff05, 0, OPTION_ARG_OPTIONAL, "Print debug message"},
|
||||
|
|
Loading…
Reference in a new issue