initial multi display support
This commit is contained in:
parent
9d6d7b3b14
commit
d4761aaf9e
4 changed files with 43 additions and 11 deletions
8
input.c
8
input.c
|
@ -140,10 +140,10 @@ void rfb_key_hook(rfbBool down, rfbKeySym keysym, rfbClientPtr cl)
|
||||||
void rfb_ptr_hook(int mask, int screen_x, int screen_y, rfbClientPtr cl)
|
void rfb_ptr_hook(int mask, int screen_x, int screen_y, rfbClientPtr cl)
|
||||||
{
|
{
|
||||||
// printf("pointer to %d, %d\n", screen_x, screen_y);
|
// printf("pointer to %d, %d\n", screen_x, screen_y);
|
||||||
float global_x = (float)screen_x;
|
float global_x = (float)(screen_x + kmsvnc->input_offx);
|
||||||
float global_y = (float)screen_y;
|
float global_y = (float)(screen_y + kmsvnc->input_offy);
|
||||||
int touch_x = round(global_x / kmsvnc->drm->mfb->width * UINPUT_ABS_MAX);
|
int touch_x = round(global_x / (kmsvnc->input_width ?: kmsvnc->drm->mfb->width) * UINPUT_ABS_MAX);
|
||||||
int touch_y = round(global_y / kmsvnc->drm->mfb->height * UINPUT_ABS_MAX);
|
int touch_y = round(global_y / (kmsvnc->input_height ?: kmsvnc->drm->mfb->height) * UINPUT_ABS_MAX);
|
||||||
struct input_event ies1[] = {
|
struct input_event ies1[] = {
|
||||||
{
|
{
|
||||||
.type = EV_ABS,
|
.type = EV_ABS,
|
||||||
|
|
32
kmsvnc.c
32
kmsvnc.c
|
@ -144,7 +144,11 @@ static struct argp_option kmsvnc_main_options[] = {
|
||||||
{"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-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"},
|
||||||
{"va-print-format", 0xff05, 0, OPTION_ARG_OPTIONAL, "Print supported vaImage format"},
|
{"va-debug", 0xff05, 0, OPTION_ARG_OPTIONAL, "Print va debug message"},
|
||||||
|
{"input-width", 0xff06, "0", 0, "Explicitly set input width, normally this is inferred from screen width on a single display system"},
|
||||||
|
{"input-height", 0xff07, "0", 0, "Explicitly set input height"},
|
||||||
|
{"input-offx", 0xff08, "0", 0, "Set input offset of x axis on a multi display system"},
|
||||||
|
{"input-offy", 0xff09, "0", 0, "Set input offset of y axis on a multi display system"},
|
||||||
{"wakeup", 'w', 0, OPTION_ARG_OPTIONAL, "Move mouse to wake the system up before start"},
|
{"wakeup", 'w', 0, OPTION_ARG_OPTIONAL, "Move mouse to wake the system up before start"},
|
||||||
{"disable-input", 'i', 0, OPTION_ARG_OPTIONAL, "Disable uinput"},
|
{"disable-input", 'i', 0, OPTION_ARG_OPTIONAL, "Disable uinput"},
|
||||||
{"desktop-name", 'n', "kmsvnc", 0, "Specify vnc desktop name"},
|
{"desktop-name", 'n', "kmsvnc", 0, "Specify vnc desktop name"},
|
||||||
|
@ -215,7 +219,31 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xff05:
|
case 0xff05:
|
||||||
kmsvnc->va_print_fmt = 1;
|
kmsvnc->va_debug = 1;
|
||||||
|
break;
|
||||||
|
case 0xff06:
|
||||||
|
int width = atoi(arg);
|
||||||
|
if (width > 0) {
|
||||||
|
kmsvnc->input_width = width;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0xff07:
|
||||||
|
int height = atoi(arg);
|
||||||
|
if (height > 0) {
|
||||||
|
kmsvnc->input_height = height;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0xff08:
|
||||||
|
int offset_x = atoi(arg);
|
||||||
|
if (offset_x > 0) {
|
||||||
|
kmsvnc->input_offx = offset_x;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0xff09:
|
||||||
|
int offset_y = atoi(arg);
|
||||||
|
if (offset_y > 0) {
|
||||||
|
kmsvnc->input_offy = offset_y;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
kmsvnc->input_wakeup = 1;
|
kmsvnc->input_wakeup = 1;
|
||||||
|
|
6
kmsvnc.h
6
kmsvnc.h
|
@ -34,9 +34,13 @@ struct kmsvnc_data
|
||||||
char input_wakeup;
|
char input_wakeup;
|
||||||
char disable_input;
|
char disable_input;
|
||||||
int va_derive_enabled;
|
int va_derive_enabled;
|
||||||
int va_print_fmt;
|
int va_debug;
|
||||||
int source_plane;
|
int source_plane;
|
||||||
int source_crtc;
|
int source_crtc;
|
||||||
|
int input_width;
|
||||||
|
int input_height;
|
||||||
|
int input_offx;
|
||||||
|
int input_offy;
|
||||||
struct kmsvnc_drm_data *drm;
|
struct kmsvnc_drm_data *drm;
|
||||||
struct kmsvnc_input_data *input;
|
struct kmsvnc_input_data *input;
|
||||||
struct kmsvnc_keymap_data *keymap;
|
struct kmsvnc_keymap_data *keymap;
|
||||||
|
|
8
va.c
8
va.c
|
@ -39,7 +39,7 @@ void va_cleanup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void va_msg_callback(void *user_context, const char *message) {
|
static void va_msg_callback(void *user_context, const char *message) {
|
||||||
if (kmsvnc->va_print_fmt) {
|
if (kmsvnc->va_debug) {
|
||||||
printf("va msg: %s", message);
|
printf("va msg: %s", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ int va_init() {
|
||||||
if (!rt_format) {
|
if (!rt_format) {
|
||||||
KMSVNC_FATAL("Unsupported pixfmt %s for vaapi, please create an issue with your pixfmt.", kmsvnc->drm->pixfmt_name);
|
KMSVNC_FATAL("Unsupported pixfmt %s for vaapi, please create an issue with your pixfmt.", kmsvnc->drm->pixfmt_name);
|
||||||
}
|
}
|
||||||
if (kmsvnc->va_print_fmt) {
|
if (kmsvnc->va_debug) {
|
||||||
printf("selected rt_format %u, alpha %d\n", rt_format, is_alpha);
|
printf("selected rt_format %u, alpha %d\n", rt_format, is_alpha);
|
||||||
}
|
}
|
||||||
prime_desc.width = kmsvnc->drm->mfb->width;
|
prime_desc.width = kmsvnc->drm->mfb->width;
|
||||||
|
@ -249,7 +249,7 @@ int va_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kmsvnc->va_print_fmt) {
|
if (kmsvnc->va_debug) {
|
||||||
for (int i = 0; i < va->img_fmt_count; i++) {
|
for (int i = 0; i < va->img_fmt_count; i++) {
|
||||||
print_va_image_fmt(va->img_fmts + i);
|
print_va_image_fmt(va->img_fmts + i);
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ int va_init() {
|
||||||
char success = 0;
|
char success = 0;
|
||||||
for (int i = 0; i < KMSVNC_ARRAY_ELEMENTS(format_to_try); i++) {
|
for (int i = 0; i < KMSVNC_ARRAY_ELEMENTS(format_to_try); i++) {
|
||||||
if (format_to_try[i].fmt == NULL) continue;
|
if (format_to_try[i].fmt == NULL) continue;
|
||||||
if (!kmsvnc->va_print_fmt && rt_format != format_to_try[i].va_rt_format) continue;
|
if (!kmsvnc->va_debug && rt_format != format_to_try[i].va_rt_format) continue;
|
||||||
if (is_alpha != format_to_try[i].is_alpha) continue;
|
if (is_alpha != format_to_try[i].is_alpha) continue;
|
||||||
|
|
||||||
VAImageFormat *fmt = format_to_try[i].fmt;
|
VAImageFormat *fmt = format_to_try[i].fmt;
|
||||||
|
|
Loading…
Reference in a new issue