refine cursor capture
This commit is contained in:
parent
daf3db0b19
commit
2fd00d80b2
2 changed files with 15 additions and 4 deletions
13
drm.c
13
drm.c
|
@ -251,6 +251,10 @@ static int drm_refresh_planes(char first_time) {
|
||||||
}
|
}
|
||||||
if (!drm->plane || (kmsvnc->capture_cursor && !drm->cursor_plane)) {
|
if (!drm->plane || (kmsvnc->capture_cursor && !drm->cursor_plane)) {
|
||||||
drmModePlane *current_plane = NULL;
|
drmModePlane *current_plane = NULL;
|
||||||
|
if (drm->plane_res) {
|
||||||
|
drmModeFreePlaneResources(kmsvnc->drm->plane_res);
|
||||||
|
drm->plane_res = NULL;
|
||||||
|
}
|
||||||
drm->plane_res = drmModeGetPlaneResources(drm->drm_fd);
|
drm->plane_res = drmModeGetPlaneResources(drm->drm_fd);
|
||||||
if (!drm->plane_res)
|
if (!drm->plane_res)
|
||||||
KMSVNC_FATAL("Failed to get plane resources: %s\n", strerror(errno));
|
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) {
|
int drm_dump_cursor_plane(char **data, int *width, int *height) {
|
||||||
struct kmsvnc_drm_data *drm = kmsvnc->drm;
|
struct kmsvnc_drm_data *drm = kmsvnc->drm;
|
||||||
|
|
||||||
|
if (!drm->cursor_plane) {
|
||||||
|
drm_refresh_planes(0); // ignore error
|
||||||
if (drm->cursor_plane) {
|
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);
|
drmModeFreePlane(drm->cursor_plane);
|
||||||
drm->cursor_plane = NULL;
|
drm->cursor_plane = NULL;
|
||||||
|
drm->cursor_plane = drmModeGetPlane(drm->drm_fd, plane_id);
|
||||||
}
|
}
|
||||||
drm_refresh_planes(0); // ignore error
|
|
||||||
if (!drm->cursor_plane) {
|
if (!drm->cursor_plane) {
|
||||||
data = NULL;
|
data = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
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"},
|
{"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-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"},
|
{"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)"},
|
{"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"},
|
{"va-derive", 0xff04, "off", 0, "Enable derive with vaapi"},
|
||||||
{"debug", 0xff05, 0, OPTION_ARG_OPTIONAL, "Print debug message"},
|
{"debug", 0xff05, 0, OPTION_ARG_OPTIONAL, "Print debug message"},
|
||||||
|
|
Loading…
Reference in a new issue