[PATCH v4 4/6] libweston: fbdev: set fb device info upon the first run.

2017-11-18 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 2756d587..b9be5455 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -361,6 +361,14 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(output, fd,
+ screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v4 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2017-11-18 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 22 --
 libweston/launcher-util.c   |  4 
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..a94ec0e9 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index fa3ed13b..848c6ade 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -111,6 +111,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) == 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v4 2/6] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2017-11-18 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 61bda282..f88608cd 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -573,6 +573,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1444,6 +1445,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 4b3605cf..2756d587 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -710,6 +710,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -734,7 +741,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run "
   "using weston-launch binary or as root\n");
@@ -779,6 +786,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..ca76a902 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,7 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v4 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2017-11-18 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, use udev to find the
first framebuffer device in the seat.
---
 libweston/compositor-fbdev.c | 45 +---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index b9be5455..c6ef8cb8 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -712,6 +712,42 @@ fbdev_restore(struct weston_compositor *compositor)
weston_launcher_restore(compositor->launcher);
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+   char *fb_device;
+   struct udev_device *device;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (!strcmp(device_seat, seat)) {
+   fb_device = udev_device_get_devnode(device);
+   udev_enumerate_unref(e);
+   break;
+   }
+   udev_device_unref(device);
+   }
+
+   udev_enumerate_unref(e);
+   return fb_device;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -744,6 +780,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device=find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device=strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -790,10 +831,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v4 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-11-18 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  | 2 +-
 libweston/compositor-drm.c | 5 +
 man/weston-drm.man | 7 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 0615d87e..61bda282 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -562,7 +562,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
"  --current-mode\tPrefer current KMS mode over EDID preferred 
mode\n\n");
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index b641d61e..0025f5ba 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4002,8 +4002,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d7fd5614..17c1ad31 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -94,8 +94,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -117,6 +117,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v4 6/6] main: don't configure /dev/fb0 by default

2017-11-18 Thread nerdopolis
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index f88608cd..cd07a6bb 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1450,9 +1450,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 0/7] Make Weston multiseat aware

2017-12-29 Thread nerdopolis
These patches make Weston handle multiple seats. Fixes from the last 
attempt include updating fbdev_set_screen_info , updating some fuzz,
and making the selection of the framebuffer device similar to 
compositor-drm.c by favoring the boot_vga device

https://github.com/n3rdopolis/weston

nerdopolis (7):
  libweston: set the seat automatically based on the XDG_SEAT
environment variable
  libweston: fbdev: support the --seat option, (and XDG_SEAT variable)
  launcher-logind: only get a VT on seat0, as only seat0 supports VTs
  libweston: fbdev: set fb device info upon the first run.
  libweston: fbdev: Attempt to detect the first framebuffer device in
the seat. instead of defaulting to /dev/fb0
  main: don't configure /dev/fb0 by default
  libweston: fbdev: Follow the same logic as compositor-drm, and favor
the boot_vga device

 compositor/main.c|  7 ++--
 libweston/compositor-drm.c   |  5 +++
 libweston/compositor-fbdev.c | 90 ++--
 libweston/compositor-fbdev.h |  1 +
 libweston/launcher-logind.c  | 22 ++-
 libweston/launcher-util.c|  4 ++
 man/weston-drm.man   |  7 +++-
 7 files changed, 116 insertions(+), 20 deletions(-)

-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 2/7] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2017-12-29 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 72ae14b9..ecd034b9 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -575,6 +575,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1448,6 +1449,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index fbab634b..ef571339 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -710,6 +710,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -734,7 +741,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run using "
   "weston-launch binary, or your system should "
@@ -780,6 +787,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..ca76a902 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,7 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 7/7] libweston: fbdev: Follow the same logic as compositor-drm, and favor the boot_vga device

2017-12-29 Thread nerdopolis
virtual framebuffer devices that are created by a modesetting driver have the 
same parent
as the drm card devices.
---
 libweston/compositor-fbdev.c | 40 ++--
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 34e6c2f3..139d6624 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -717,8 +717,8 @@ find_framebuffer_device(struct fbdev_backend *b, const char 
*seat)
struct udev_enumerate *e;
struct udev_list_entry *entry;
const char *path, *device_seat;
-   char *fb_device;
-   struct udev_device *device;
+   char *fb_device, *find_device, *id;
+   struct udev_device *device, *pci;
 
e = udev_enumerate_new(b->udev);
udev_enumerate_add_match_subsystem(e, "graphics");
@@ -727,20 +727,48 @@ find_framebuffer_device(struct fbdev_backend *b, const 
char *seat)
udev_enumerate_scan_devices(e);
fb_device = NULL;
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+   bool is_boot_vga = false;
 
path = udev_list_entry_get_name(entry);
device = udev_device_new_from_syspath(b->udev, path);
+   find_device = udev_device_get_devnode(device);
if (!device)
continue;
device_seat = udev_device_get_property_value(device, "ID_SEAT");
if (!device_seat)
device_seat = default_seat;
-   if (!strcmp(device_seat, seat)) {
-   fb_device = udev_device_get_devnode(device);
-   udev_enumerate_unref(e);
+   if (strcmp(device_seat, seat)) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   pci = udev_device_get_parent_with_subsystem_devtype(device,
+   "pci", NULL);
+   if (pci) {
+   id = udev_device_get_sysattr_value(pci, "boot_vga");
+   if (id && !strcmp(id, "1"))
+   is_boot_vga = true;
+   }
+
+   /* If a framebuffer device was found, and this device isn't
+* the boot-VGA device, don't use it. */
+   if (!is_boot_vga && fb_device) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   /* There can only be one boot_vga device. Try to use it
+* at all costs. */
+   if (is_boot_vga) {
+   fb_device = find_device;
break;
}
-   udev_device_unref(device);
+
+   /* Per the (!is_boot_vga && fb_device) test above, only
+* trump existing saved devices with boot-VGA devices, so if
+* the test ends up here, this must be the first device seen. */
+   assert(!fb_device);
+   fb_device = find_device;
}
 
udev_enumerate_unref(e);
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 6/7] main: don't configure /dev/fb0 by default

2017-12-29 Thread nerdopolis
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index ecd034b9..02de108b 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1454,9 +1454,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 3/7] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2017-12-29 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 22 --
 libweston/launcher-util.c   |  4 
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index 21d8c37b..875db70f 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -769,18 +769,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index 96a0ba6f..777ab755 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -111,6 +111,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) == 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 1/7] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-12-29 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  | 2 +-
 libweston/compositor-drm.c | 5 +
 man/weston-drm.man | 7 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 7feb4cb0..72ae14b9 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -563,7 +563,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 3eda70f3..5585944e 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4036,8 +4036,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/man/weston-drm.man b/man/weston-drm.man
index 75d79021..883395f2 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -101,8 +101,8 @@ status. For example, use
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -124,6 +124,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 5/7] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2017-12-29 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, use udev to find the
first framebuffer device in the seat.
---
 libweston/compositor-fbdev.c | 45 +---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 39668aa8..34e6c2f3 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -711,6 +711,42 @@ fbdev_restore(struct weston_compositor *compositor)
weston_launcher_restore(compositor->launcher);
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+   char *fb_device;
+   struct udev_device *device;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (!strcmp(device_seat, seat)) {
+   fb_device = udev_device_get_devnode(device);
+   udev_enumerate_unref(e);
+   break;
+   }
+   udev_device_unref(device);
+   }
+
+   udev_enumerate_unref(e);
+   return fb_device;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -743,6 +779,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device=find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device=strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -790,10 +831,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v5 4/7] libweston: fbdev: set fb device info upon the first run.

2017-12-29 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index ef571339..39668aa8 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -361,6 +361,13 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v5 5/7] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2018-01-22 Thread nerdopolis
On Monday, January 22, 2018 4:50:35 AM EST Pekka Paalanen wrote:
> On Fri, 29 Dec 2017 13:31:51 -0500
> nerdopolis  wrote:
> 
> > This adds a function to detect the first framebuffer device in the
> > current seat. Instead of hardcoding /dev/fb0, use udev to find the
> > first framebuffer device in the seat.
> > ---
> >  libweston/compositor-fbdev.c | 45 
> > +---
> >  1 file changed, 42 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> > index 39668aa8..34e6c2f3 100644
> > --- a/libweston/compositor-fbdev.c
> > +++ b/libweston/compositor-fbdev.c
> > @@ -711,6 +711,42 @@ fbdev_restore(struct weston_compositor *compositor)
> > weston_launcher_restore(compositor->launcher);
> >  }
> >  
> > +static char *
> > +find_framebuffer_device(struct fbdev_backend *b, const char *seat)
> > +{
> > +   struct udev_enumerate *e;
> > +   struct udev_list_entry *entry;
> > +   const char *path, *device_seat;
> > +   char *fb_device;
> > +   struct udev_device *device;
> > +
> > +   e = udev_enumerate_new(b->udev);
> > +   udev_enumerate_add_match_subsystem(e, "graphics");
> > +   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
> > +
> > +   udev_enumerate_scan_devices(e);
> > +   fb_device = NULL;
> > +   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
> > +
> > +   path = udev_list_entry_get_name(entry);
> > +   device = udev_device_new_from_syspath(b->udev, path);
> > +   if (!device)
> > +   continue;
> > +   device_seat = udev_device_get_property_value(device, "ID_SEAT");
> > +   if (!device_seat)
> > +   device_seat = default_seat;
> > +   if (!strcmp(device_seat, seat)) {
> > +   fb_device = udev_device_get_devnode(device);
> > +   udev_enumerate_unref(e);
> 
> Hi,
> 
> seems like this should be udev_device_unref() instead, otherwise
> 'e' is unreffed twice and 'device' is leaked.
> 
Patch 7 improves this function somewhat, but I don't really know how to squash 
5 and 7 into
5 without squashing 6... ...I guess I could just copy and paste that manually...

With patch 7 applied on top of this, is the only issue that I just need to do
   fb_device = strdup(find_device);
   udev_device_unref(device);
to be able to unref device ? 

> > +   break;
> > +   }
> > +   udev_device_unref(device);
> > +   }
> > +
> > +   udev_enumerate_unref(e);
> > +   return fb_device;
> > +}
> > +
> >  static struct fbdev_backend *
> >  fbdev_backend_create(struct weston_compositor *compositor,
> >   struct weston_fbdev_backend_config *param)
> > @@ -743,6 +779,11 @@ fbdev_backend_create(struct weston_compositor 
> > *compositor,
> > goto out_compositor;
> > }
> >  
> > +   if (!param->device)
> > +   param->device=find_framebuffer_device(backend, seat_id);
> > +   if (!param->device)
> > +   param->device=strdup("/dev/fb0");
> 
> Missing spaces around '=' on both lines.
> 
> The assigned string is leaked, there is no free() for it. However, one
> must take care to not free() the string that came as an argument via
> weston_fbdev_backend_config struct.
> 
Not sure what I need to do here, regarding the free() TBH.
The issue is with the param->device=strdup("/dev/fb0"); line correct?
Is the issue that the hardcoded "/dev/fb0" string that is strdup'ed stuck in 
memory?

> > +
> > /* Set up the TTY. */
> > backend->session_listener.notify = session_notify;
> > wl_signal_add(&compositor->session_signal,
> > @@ -790,10 +831,8 @@ out_compositor:
> >  static void
> >  config_init_to_defaults(struct weston_fbdev_backend_config *config)
> >  {
> > -   /* TODO: Ideally, available frame buffers should be enumerated using
> > -* udev, rather than passing a device node in as a parameter. */
> > config->tty = 0; /* default to current tty */
> > -   config->device = "/dev/fb0"; /* default frame buffer */
> > +   config->device = NULL;
> > config->seat_id = NULL;
> >  }
> >  
> 
> Otherwise looks good to me.
> 
> 
> Thanks,
> pq
> 


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v6 0/6] Make Weston multiseat aware

2018-01-23 Thread nerdopolis
These patches make Weston handle multiple seats. Fixes from the last 
attempt include updating fbdev_set_screen_info , updating some fuzz,
and making the selection of the framebuffer device similar to 
compositor-drm.c by favoring the boot_vga device, and making
requested changes

nerdopolis (6):
  libweston: set the seat automatically based on the XDG_SEAT
environment variable
  libweston: fbdev: support the --seat option, (and XDG_SEAT variable)
  launcher-logind: only get a VT on seat0, as only seat0 supports VTs
  libweston: fbdev: set fb device info upon the first run.
  libweston: fbdev: Attempt to detect the first framebuffer device in
the seat. instead of defaulting to /dev/fb0
  main: don't configure /dev/fb0 by default

 compositor/main.c|  7 ++--
 libweston/compositor-drm.c   |  5 +++
 libweston/compositor-fbdev.c | 94 ++--
 libweston/compositor-fbdev.h |  1 +
 libweston/launcher-logind.c  | 22 ++-
 libweston/launcher-util.c|  4 ++
 man/weston-drm.man   |  7 +++-
 7 files changed, 120 insertions(+), 20 deletions(-)

-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v6 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2018-01-23 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, detect the device
with udev, favoring the boot_vga device, and falling back to the
first framebuffer device in the seat if there is none. This is very
similar to what compositor-drm does to find display devices
---
 libweston/compositor-fbdev.c | 77 ++--
 1 file changed, 74 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 39668aa8..8cf0922e 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -711,6 +711,71 @@ fbdev_restore(struct weston_compositor *compositor)
weston_launcher_restore(compositor->launcher);
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+   char *fb_device, *find_device, *id;
+   struct udev_device *device, *pci;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+   bool is_boot_vga = false;
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   find_device = udev_device_get_devnode(device);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (strcmp(device_seat, seat)) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   pci = udev_device_get_parent_with_subsystem_devtype(device,
+   "pci", NULL);
+   if (pci) {
+   id = udev_device_get_sysattr_value(pci, "boot_vga");
+   if (id && !strcmp(id, "1"))
+   is_boot_vga = true;
+   }
+
+   /* If a framebuffer device was found, and this device isn't
+* the boot-VGA device, don't use it. */
+   if (!is_boot_vga && fb_device) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   /* There can only be one boot_vga device. Try to use it
+* at all costs. */
+   if (is_boot_vga) {
+   fb_device = strdup(find_device);
+   udev_device_unref(device);
+   break;
+   }
+
+   /* Per the (!is_boot_vga && fb_device) test above, only
+* trump existing saved devices with boot-VGA devices, so if
+* the test ends up here, this must be the first device seen. */
+   assert(!fb_device);
+   fb_device = find_device;
+   }
+
+   udev_enumerate_unref(e);
+   return fb_device;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -743,6 +808,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device = strdup(find_framebuffer_device(backend, 
seat_id));
+   if (!param->device)
+   param->device = strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -769,12 +839,15 @@ fbdev_backend_create(struct weston_compositor *compositor,
if (fbdev_output_create(backend, param->device) < 0)
goto out_launcher;
 
+   free(param->device);
+
udev_input_init(&backend->input, compositor, backend->udev,
seat_id, param->configure_device);
 
return backend;
 
 out_launcher:
+   free(param->device);
weston_launcher_destroy(compositor->launcher);
 
 out_udev:
@@ -790,10 +863,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.o

[PATCH v6 4/6] libweston: fbdev: set fb device info upon the first run.

2018-01-23 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index ef571339..39668aa8 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -361,6 +361,13 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v6 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2018-01-23 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  | 2 +-
 libweston/compositor-drm.c | 5 +
 man/weston-drm.man | 7 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 7feb4cb0..72ae14b9 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -563,7 +563,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 3eda70f3..5585944e 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4036,8 +4036,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/man/weston-drm.man b/man/weston-drm.man
index 75d79021..883395f2 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -101,8 +101,8 @@ status. For example, use
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -124,6 +124,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v6 6/6] main: don't configure /dev/fb0 by default

2018-01-23 Thread nerdopolis
The framebuffer backend now detects the framebuffer device
dynamically. Don't assume that the framebuffer device is /dev/fb0
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index ecd034b9..02de108b 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1454,9 +1454,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v6 2/6] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2018-01-23 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 72ae14b9..ecd034b9 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -575,6 +575,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1448,6 +1449,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index fbab634b..ef571339 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -710,6 +710,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -734,7 +741,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run using "
   "weston-launch binary, or your system should "
@@ -780,6 +787,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..ca76a902 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,7 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v6 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2018-01-23 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 22 --
 libweston/launcher-util.c   |  4 
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index 21d8c37b..875db70f 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -769,18 +769,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index 96a0ba6f..777ab755 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -111,6 +111,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) == 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v6 0/6] Make Weston multiseat aware

2018-04-23 Thread nerdopolis
On Tuesday, January 23, 2018 10:15:42 PM EDT nerdopolis wrote:
> These patches make Weston handle multiple seats. Fixes from the last 
> attempt include updating fbdev_set_screen_info , updating some fuzz,
> and making the selection of the framebuffer device similar to 
> compositor-drm.c by favoring the boot_vga device, and making
> requested changes
> 
> nerdopolis (6):
>   libweston: set the seat automatically based on the XDG_SEAT
> environment variable
>   libweston: fbdev: support the --seat option, (and XDG_SEAT variable)
>   launcher-logind: only get a VT on seat0, as only seat0 supports VTs
>   libweston: fbdev: set fb device info upon the first run.
>   libweston: fbdev: Attempt to detect the first framebuffer device in
> the seat. instead of defaulting to /dev/fb0
>   main: don't configure /dev/fb0 by default
> 
>  compositor/main.c|  7 ++--
>  libweston/compositor-drm.c   |  5 +++
>  libweston/compositor-fbdev.c | 94 
> ++--
>  libweston/compositor-fbdev.h |  1 +
>  libweston/launcher-logind.c  | 22 ++-
>  libweston/launcher-util.c|  4 ++
>  man/weston-drm.man   |  7 +++-
>  7 files changed, 120 insertions(+), 20 deletions(-)
> 
> 
Hi

I have made sure, These patches still apply and work for Weston Master. (with a 
little patch fuzz)
Is there anything I need to do?

Thanks

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v6 0/6] Make Weston multiseat aware

2018-06-08 Thread nerdopolis
On Tuesday, January 23, 2018 10:15:42 PM EDT you wrote:
> These patches make Weston handle multiple seats. Fixes from the last 
> attempt include updating fbdev_set_screen_info , updating some fuzz,
> and making the selection of the framebuffer device similar to 
> compositor-drm.c by favoring the boot_vga device, and making
> requested changes
> 
> nerdopolis (6):
>   libweston: set the seat automatically based on the XDG_SEAT
> environment variable
>   libweston: fbdev: support the --seat option, (and XDG_SEAT variable)
>   launcher-logind: only get a VT on seat0, as only seat0 supports VTs
>   libweston: fbdev: set fb device info upon the first run.
>   libweston: fbdev: Attempt to detect the first framebuffer device in
> the seat. instead of defaulting to /dev/fb0
>   main: don't configure /dev/fb0 by default
> 
>  compositor/main.c|  7 ++--
>  libweston/compositor-drm.c   |  5 +++
>  libweston/compositor-fbdev.c | 94 
> ++--
>  libweston/compositor-fbdev.h |  1 +
>  libweston/launcher-logind.c  | 22 ++-
>  libweston/launcher-util.c|  4 ++
>  man/weston-drm.man   |  7 +++-
>  7 files changed, 120 insertions(+), 20 deletions(-)
> 
> 

These patches still apply.
Is there anything I need to do?
https://bugs.freedesktop.org/show_bug.cgi?id=102307 was closed station that 
this will be discussed on the mailing list


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v6 0/6] Make Weston multiseat aware

2018-06-08 Thread nerdopolis
On Friday, June 8, 2018 9:40:47 AM EDT Pekka Paalanen wrote:
> On Fri, 08 Jun 2018 08:23:02 -0400
> nerdopolis  wrote:
> 
> > On Tuesday, January 23, 2018 10:15:42 PM EDT you wrote:
> > > These patches make Weston handle multiple seats. Fixes from the last 
> > > attempt include updating fbdev_set_screen_info , updating some fuzz,
> > > and making the selection of the framebuffer device similar to 
> > > compositor-drm.c by favoring the boot_vga device, and making
> > > requested changes
> > > 
> > > nerdopolis (6):
> > >   libweston: set the seat automatically based on the XDG_SEAT
> > > environment variable
> > >   libweston: fbdev: support the --seat option, (and XDG_SEAT variable)
> > >   launcher-logind: only get a VT on seat0, as only seat0 supports VTs
> > >   libweston: fbdev: set fb device info upon the first run.
> > >   libweston: fbdev: Attempt to detect the first framebuffer device in
> > > the seat. instead of defaulting to /dev/fb0
> > >   main: don't configure /dev/fb0 by default
> > > 
> > >  compositor/main.c|  7 ++--
> > >  libweston/compositor-drm.c   |  5 +++
> > >  libweston/compositor-fbdev.c | 94 
> > > ++--
> > >  libweston/compositor-fbdev.h |  1 +
> > >  libweston/launcher-logind.c  | 22 ++-
> > >  libweston/launcher-util.c|  4 ++
> > >  man/weston-drm.man   |  7 +++-
> > >  7 files changed, 120 insertions(+), 20 deletions(-)
> > > 
> > >   
> > 
> > These patches still apply.
> > Is there anything I need to do?
> > https://bugs.freedesktop.org/show_bug.cgi?id=102307 was closed station that 
> > this will be discussed on the mailing list
> 
> Hi,
> 
> your patches are tracked at
> https://patchwork.freedesktop.org/series/35856/ as "New" so there is
> nothing you are required to do until you get feedback, though pinging
> every couple of weeks is ok to remind us to look at them.
> 
> 
> Thanks,
> pq
Understandable. Thanks! 



___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v6 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2018-06-26 Thread nerdopolis
On Tuesday, June 12, 2018 7:23:19 AM EDT Pekka Paalanen wrote:
> On Tue, 23 Jan 2018 22:15:43 -0500
> nerdopolis  wrote:
> 
> > This will allow the seat to be set by the environment as pam_systemd 
> > typically
> > sets the XDG_SEAT variable
> > ---
> >  compositor/main.c  | 2 +-
> >  libweston/compositor-drm.c | 5 +
> >  man/weston-drm.man | 7 +--
> >  3 files changed, 11 insertions(+), 3 deletions(-)
> > 
> 
> Hi,
> 
> this looks like a good addition. Mostly cosmetic nitpicks below.
> 
> > diff --git a/compositor/main.c b/compositor/main.c
> > index 7feb4cb0..72ae14b9 100644
> > --- a/compositor/main.c
> > +++ b/compositor/main.c
> > @@ -563,7 +563,7 @@ usage(int error_code)
> >  #if defined(BUILD_DRM_COMPOSITOR)
> > fprintf(stderr,
> > "Options for drm-backend.so:\n\n"
> > -   "  --seat=SEAT\t\tThe seat that weston should run on\n"
> > +   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
> > of the seat defined in XDG_SEAT\n"
> > "  --tty=TTY\t\tThe tty to use\n"
> > "  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
> > "  --use-pixman\t\tUse the pixman (CPU) renderer\n"
> > diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> > index 3eda70f3..5585944e 100644
> > --- a/libweston/compositor-drm.c
> > +++ b/libweston/compositor-drm.c
> > @@ -4036,8 +4036,13 @@ drm_backend_create(struct weston_compositor 
> > *compositor,
> > struct udev_device *drm_device;
> > struct wl_event_loop *loop;
> > const char *seat_id = default_seat;
> > +   const char *session_seat;
> > int ret;
> >  
> > +   session_seat = getenv("XDG_SEAT");
> > +   if (session_seat)
> > +   seat_id = session_seat;
> > +
> 
> It would be good to move the config->seat_id handling here as well so
> they are all in the same place.
> 
> In compositor-drm.h the seat_id member's comments need updating too.
> 
> > weston_log("initializing drm backend\n");
> >  
> > b = zalloc(sizeof *b);
> > diff --git a/man/weston-drm.man b/man/weston-drm.man
> > index 75d79021..883395f2 100644
> > --- a/man/weston-drm.man
> > +++ b/man/weston-drm.man
> > @@ -101,8 +101,8 @@ status. For example, use
> >  \fB\-\-seat\fR=\fIseatid\fR
> >  Use graphics and input devices designated for seat
> >  .I seatid
> > -instead of the default seat
> > -.BR seat0 .
> > +instead of the seat defined in the environment variable
> > +. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
> 
> I'd format that like this:
> . BR XDG_SEAT ". If neither is specifed, seat0 will be assumed."
> 
> >  .TP
> >  \fB\-\-tty\fR=\fIx\fR
> >  Launch Weston on tty
> > @@ -124,6 +124,9 @@ The file descriptor (integer) where
> >  .B weston-launch
> >  is listening. Automatically set by
> >  .BR weston-launch .
> > +.TP
> > +.B XDG_SEAT
> > +The seat that Weston will start on.
> 
> The default seat, since we have the command line option to override it.
I think I was sure on your other requested changes, and made them. I guess
I will have to figure out the new way to submit this... ...however this is 
the one thing I have a remaining question on Should it say 
"The default seat Weston will start on"?
or should it say
"The default seat if the --seat command line option is not specified"

Thanks
> 
> >  .
> >  .\" ***
> >  .SH "SEE ALSO"
> 
> 
> Thanks,
> pq




___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2018-06-26 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 22 --
 libweston/launcher-util.c   |  4 
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index d0559c8f..36a4e642 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index 03f3219b..41ac7950 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -104,6 +104,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) <= 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 0/6] Make Weston multiseat aware

2018-06-26 Thread nerdopolis
These patches make Weston handle multiple seats. Fixes from the last 
attempt include updating fbdev_set_screen_info , updating some fuzz,
and making the selection of the framebuffer device similar to 
compositor-drm.c by favoring the boot_vga device, and making
requested changes


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 2/6] compositor-fbdev: support the --seat option, (and XDG_SEAT variable)

2018-06-26 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  9 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 7bfe0a33..068cdd8f 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -494,6 +494,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1593,6 +1594,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index a78f6fab..09a2eb39 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -776,6 +776,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -800,7 +807,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run using "
   "weston-launch binary, or your system should "
@@ -846,6 +853,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..540120a4 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,15 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+
+   /** The seat to be used for input and output.
+*
+* Set first by the XDG_SEAT variable, and overridable by the --seat 
option.
+* If none are specified, the default "seat0" is assumed. The backend 
will
+* take ownership of the seat_id pointer and will free it on
+* backend destruction.
+*/
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 5/6] compositor-fbdev: detect the first fb device in the seat

2018-06-26 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, detect the device
with udev, favoring the boot_vga device, and falling back to the
first framebuffer device in the seat if there is none. This is very
similar to what compositor-drm does to find display devices
---
 libweston/compositor-fbdev.c | 83 ++--
 1 file changed, 80 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index e3777495..616300dc 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -777,6 +777,77 @@ session_notify(struct wl_listener *listener, void *data)
}
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat, *id, *fb_device_path;
+   struct udev_device *device, *fb_device, *pci;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+   bool is_boot_vga = false;
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (strcmp(device_seat, seat)) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   pci = udev_device_get_parent_with_subsystem_devtype(device,
+   "pci", NULL);
+   if (pci) {
+   id = udev_device_get_sysattr_value(pci, "boot_vga");
+   if (id && !strcmp(id, "1"))
+   is_boot_vga = true;
+   }
+
+   /* If a framebuffer device was found, and this device isn't
+* the boot-VGA device, don't use it. */
+   if (!is_boot_vga && fb_device) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   /* There can only be one boot_vga device. Try to use it
+* at all costs. */
+   if (is_boot_vga) {
+   if (fb_device)
+   udev_device_unref(fb_device);
+   fb_device = device;
+   break;
+   }
+
+   /* Per the (!is_boot_vga && fb_device) test above, only
+* trump existing saved devices with boot-VGA devices, so if
+* the test ends up here, this must be the first device seen. */
+   assert(!fb_device);
+   fb_device = device;
+   }
+
+   udev_enumerate_unref(e);
+
+   if (fb_device)
+   {
+   fb_device_path=strdup(udev_device_get_devnode(fb_device));
+   udev_device_unref(fb_device);
+   }
+
+   return fb_device_path;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -809,6 +880,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device = find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device = strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -835,12 +911,15 @@ fbdev_backend_create(struct weston_compositor *compositor,
if (!fbdev_head_create(backend, param->device))
goto out_launcher;
 
+   free(param->device);
+
udev_input_init(&backend->input, compositor, backend->udev,
seat_id, param->configure_device);
 
return backend;
 
 out_launcher:
+   free(param->device);
weston_launcher_destroy(compositor->launcher);
 
 out_udev:
@@ -856,10 +935,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.17.1

__

[PATCH v7 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2018-06-26 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  |  2 +-
 libweston/compositor-drm.c | 11 ---
 libweston/compositor-drm.h |  3 ++-
 man/weston-drm.man |  7 +--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 2cb50c19..7bfe0a33 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -482,7 +482,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(out,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8b1ea66d..4a352132 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -6029,8 +6029,16 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
+   if (config->seat_id)
+   seat_id = config->seat_id;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
@@ -6062,9 +6070,6 @@ drm_backend_create(struct weston_compositor *compositor,
if (parse_gbm_format(config->gbm_format, GBM_FORMAT_XRGB, 
&b->gbm_format) < 0)
goto err_compositor;
 
-   if (config->seat_id)
-   seat_id = config->seat_id;
-
/* Check if we run drm-backend using weston-launch */
compositor->launcher = weston_launcher_connect(compositor, config->tty,
   seat_id, true);
diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
index 5393..edf4b8e6 100644
--- a/libweston/compositor-drm.h
+++ b/libweston/compositor-drm.h
@@ -106,7 +106,8 @@ struct weston_drm_backend_config {
 
/** The seat to be used for input and output.
 *
-* If NULL the default "seat0" will be used.  The backend will
+* Set first by the XDG_SEAT variable, and overridable by the --seat 
option.
+* If none are specified, the default "seat0" is assumed. The backend 
will
 * take ownership of the seat_id pointer and will free it on
 * backend destruction.
 */
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d4cb75a7..7ebfadf7 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -105,8 +105,8 @@ status. For example, use
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT ". If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -133,6 +133,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat Weston will start on, unless overridden on the command line.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 6/6] main: don't configure /dev/fb0 by default

2018-06-26 Thread nerdopolis
The framebuffer backend now detects the framebuffer device
dynamically. Don't assume that the framebuffer device is /dev/fb0
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 068cdd8f..f1ee02b4 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1599,9 +1599,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 4/6] compositor-fbdev: set fb device info upon the first run.

2018-06-26 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 09a2eb39..e3777495 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -384,6 +384,13 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v8 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2018-06-27 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 23 +--
 libweston/launcher-util.c   |  4 
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index d0559c8f..34e6e5ca 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,17 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   r = strcmp(t, "seat0");
+   free(t);
+   if (r == 0) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
 
loop = wl_display_get_event_loop(compositor->wl_display);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index 03f3219b..41ac7950 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -104,6 +104,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) <= 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v8 5/6] compositor-fbdev: detect the first fb device in the seat

2018-06-27 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, detect the device
with udev, favoring the boot_vga device, and falling back to the
first framebuffer device in the seat if there is none. This is very
similar to what compositor-drm does to find display devices
---
 libweston/compositor-fbdev.c | 83 ++--
 1 file changed, 80 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index e3777495..616300dc 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -777,6 +777,77 @@ session_notify(struct wl_listener *listener, void *data)
}
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat, *id, *fb_device_path;
+   struct udev_device *device, *fb_device, *pci;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+   bool is_boot_vga = false;
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (strcmp(device_seat, seat)) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   pci = udev_device_get_parent_with_subsystem_devtype(device,
+   "pci", NULL);
+   if (pci) {
+   id = udev_device_get_sysattr_value(pci, "boot_vga");
+   if (id && !strcmp(id, "1"))
+   is_boot_vga = true;
+   }
+
+   /* If a framebuffer device was found, and this device isn't
+* the boot-VGA device, don't use it. */
+   if (!is_boot_vga && fb_device) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   /* There can only be one boot_vga device. Try to use it
+* at all costs. */
+   if (is_boot_vga) {
+   if (fb_device)
+   udev_device_unref(fb_device);
+   fb_device = device;
+   break;
+   }
+
+   /* Per the (!is_boot_vga && fb_device) test above, only
+* trump existing saved devices with boot-VGA devices, so if
+* the test ends up here, this must be the first device seen. */
+   assert(!fb_device);
+   fb_device = device;
+   }
+
+   udev_enumerate_unref(e);
+
+   if (fb_device)
+   {
+   fb_device_path=strdup(udev_device_get_devnode(fb_device));
+   udev_device_unref(fb_device);
+   }
+
+   return fb_device_path;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -809,6 +880,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device = find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device = strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -835,12 +911,15 @@ fbdev_backend_create(struct weston_compositor *compositor,
if (!fbdev_head_create(backend, param->device))
goto out_launcher;
 
+   free(param->device);
+
udev_input_init(&backend->input, compositor, backend->udev,
seat_id, param->configure_device);
 
return backend;
 
 out_launcher:
+   free(param->device);
weston_launcher_destroy(compositor->launcher);
 
 out_udev:
@@ -856,10 +935,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.17.1

__

[PATCH v8 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2018-06-27 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  |  2 +-
 libweston/compositor-drm.c | 11 ---
 libweston/compositor-drm.h |  3 ++-
 man/weston-drm.man |  7 +--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 2cb50c19..7bfe0a33 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -482,7 +482,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(out,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8b1ea66d..4a352132 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -6029,8 +6029,16 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
+   if (config->seat_id)
+   seat_id = config->seat_id;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
@@ -6062,9 +6070,6 @@ drm_backend_create(struct weston_compositor *compositor,
if (parse_gbm_format(config->gbm_format, GBM_FORMAT_XRGB, 
&b->gbm_format) < 0)
goto err_compositor;
 
-   if (config->seat_id)
-   seat_id = config->seat_id;
-
/* Check if we run drm-backend using weston-launch */
compositor->launcher = weston_launcher_connect(compositor, config->tty,
   seat_id, true);
diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
index 5393..edf4b8e6 100644
--- a/libweston/compositor-drm.h
+++ b/libweston/compositor-drm.h
@@ -106,7 +106,8 @@ struct weston_drm_backend_config {
 
/** The seat to be used for input and output.
 *
-* If NULL the default "seat0" will be used.  The backend will
+* Set first by the XDG_SEAT variable, and overridable by the --seat 
option.
+* If none are specified, the default "seat0" is assumed. The backend 
will
 * take ownership of the seat_id pointer and will free it on
 * backend destruction.
 */
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d4cb75a7..7ebfadf7 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -105,8 +105,8 @@ status. For example, use
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT ". If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -133,6 +133,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat Weston will start on, unless overridden on the command line.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v7 0/6] Make Weston multiseat aware

2018-06-27 Thread nerdopolis


These patches make Weston handle multiple seats. Fixes from the last 
attempt include updating fbdev_set_screen_info , updating some fuzz,
and making the selection of the framebuffer device similar to 
compositor-drm.c by favoring the boot_vga device, and making
requested changes. These now address some memory leaks, and other 
changes requested.


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v8 4/6] compositor-fbdev: set fb device info upon the first run.

2018-06-27 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 09a2eb39..e3777495 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -384,6 +384,13 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v8 2/6] compositor-fbdev: support the --seat option, (and XDG_SEAT variable)

2018-06-27 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  9 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 7bfe0a33..068cdd8f 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -494,6 +494,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1593,6 +1594,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index a78f6fab..09a2eb39 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -776,6 +776,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -800,7 +807,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run using "
   "weston-launch binary, or your system should "
@@ -846,6 +853,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..540120a4 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,15 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+
+   /** The seat to be used for input and output.
+*
+* Set first by the XDG_SEAT variable, and overridable by the --seat 
option.
+* If none are specified, the default "seat0" is assumed. The backend 
will
+* take ownership of the seat_id pointer and will free it on
+* backend destruction.
+*/
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v8 6/6] main: don't configure /dev/fb0 by default

2018-06-27 Thread nerdopolis
The framebuffer backend now detects the framebuffer device
dynamically. Don't assume that the framebuffer device is /dev/fb0
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 068cdd8f..f1ee02b4 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1599,9 +1599,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 2/6] compositor-fbdev: support the --seat option, (and XDG_SEAT variable)

2018-06-29 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  9 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 7bfe0a33..068cdd8f 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -494,6 +494,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1593,6 +1594,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index a78f6fab..09a2eb39 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -776,6 +776,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -800,7 +807,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run using "
   "weston-launch binary, or your system should "
@@ -846,6 +853,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..29c21828 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,15 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+
+   /** The seat to be used for input and output.
+*
+* If seat_id is NULL, the seat is taken from XDG_SEAT environment
+* variable. If neither is set, "seat0" is used. The backend will
+* take ownership of the seat_id pointer and will free it on
+* backend destruction.
+*/
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 4/6] compositor-fbdev: set fb device info upon the first run.

2018-06-29 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 09a2eb39..74971c35 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -384,6 +384,14 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to wake up the framebuffer device, needed for secondary
+* framebuffer devices */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 6/6] main: don't configure /dev/fb0 by default

2018-06-29 Thread nerdopolis
The framebuffer backend now detects the framebuffer device
dynamically. Don't assume that the framebuffer device is /dev/fb0
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 068cdd8f..f1ee02b4 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1599,9 +1599,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2018-06-29 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 23 +--
 libweston/launcher-util.c   |  4 
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index d0559c8f..34e6e5ca 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,17 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   r = strcmp(t, "seat0");
+   free(t);
+   if (r == 0) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
 
loop = wl_display_get_event_loop(compositor->wl_display);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index 03f3219b..41ac7950 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -104,6 +104,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) <= 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2018-06-29 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  |  2 +-
 libweston/compositor-drm.c | 11 ---
 libweston/compositor-drm.h |  3 ++-
 man/weston-drm.man |  7 +--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 2cb50c19..7bfe0a33 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -482,7 +482,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(out,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8b1ea66d..4a352132 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -6029,8 +6029,16 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
+   if (config->seat_id)
+   seat_id = config->seat_id;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
@@ -6062,9 +6070,6 @@ drm_backend_create(struct weston_compositor *compositor,
if (parse_gbm_format(config->gbm_format, GBM_FORMAT_XRGB, 
&b->gbm_format) < 0)
goto err_compositor;
 
-   if (config->seat_id)
-   seat_id = config->seat_id;
-
/* Check if we run drm-backend using weston-launch */
compositor->launcher = weston_launcher_connect(compositor, config->tty,
   seat_id, true);
diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
index 5393..9c37c153 100644
--- a/libweston/compositor-drm.h
+++ b/libweston/compositor-drm.h
@@ -106,7 +106,8 @@ struct weston_drm_backend_config {
 
/** The seat to be used for input and output.
 *
-* If NULL the default "seat0" will be used.  The backend will
+* If seat_id is NULL, the seat is taken from XDG_SEAT environment
+* variable. If neither is set, "seat0" is used. The backend will
 * take ownership of the seat_id pointer and will free it on
 * backend destruction.
 */
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d4cb75a7..e3555e2b 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -105,8 +105,8 @@ status. For example, use
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+.BR XDG_SEAT ". If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -133,6 +133,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat Weston will start on, unless overridden on the command line.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.17.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 0/6] Make Weston multiseat aware

2018-06-29 Thread nerdopolis
These patches make Weston handle multiple seats. Fixes from the last 
attempt include updating fbdev_set_screen_info , updating some fuzz,
and making the selection of the framebuffer device similar to 
compositor-drm.c by favoring the boot_vga device, and making
requested changes. These now address some memory leaks, and other 
changes requested.


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v9 5/6] compositor-fbdev: detect the first fb device in the seat

2018-06-29 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, detect the device
with udev, favoring the boot_vga device, and falling back to the
first framebuffer device in the seat if there is none. This is very
similar to what compositor-drm does to find display devices
---
 libweston/compositor-fbdev.c | 85 ++--
 1 file changed, 82 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 74971c35..a71b7bdc 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -778,6 +778,77 @@ session_notify(struct wl_listener *listener, void *data)
}
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat, *id;
+   char *fb_device_path = NULL;
+   struct udev_device *device, *fb_device, *pci;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+   bool is_boot_vga = false;
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (strcmp(device_seat, seat)) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   pci = udev_device_get_parent_with_subsystem_devtype(device,
+   "pci", NULL);
+   if (pci) {
+   id = udev_device_get_sysattr_value(pci, "boot_vga");
+   if (id && !strcmp(id, "1"))
+   is_boot_vga = true;
+   }
+
+   /* If a framebuffer device was found, and this device isn't
+* the boot-VGA device, don't use it. */
+   if (!is_boot_vga && fb_device) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   /* There can only be one boot_vga device. Try to use it
+* at all costs. */
+   if (is_boot_vga) {
+   if (fb_device)
+   udev_device_unref(fb_device);
+   fb_device = device;
+   break;
+   }
+
+   /* Per the (!is_boot_vga && fb_device) test above, only
+* trump existing saved devices with boot-VGA devices, so if
+* the test ends up here, this must be the first device seen. */
+   assert(!fb_device);
+   fb_device = device;
+   }
+
+   udev_enumerate_unref(e);
+
+   if (fb_device) {
+   fb_device_path = strdup(udev_device_get_devnode(fb_device));
+   udev_device_unref(fb_device);
+   }
+
+   return fb_device_path;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -810,6 +881,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device = find_framebuffer_device(backend, seat_id);
+   if (!param->device) {
+   weston_log("fatal: no framebuffer devices detected.\n");
+   goto out_udev;
+   }
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -836,12 +914,15 @@ fbdev_backend_create(struct weston_compositor *compositor,
if (!fbdev_head_create(backend, param->device))
goto out_launcher;
 
+   free(param->device);
+
udev_input_init(&backend->input, compositor, backend->udev,
seat_id, param->configure_device);
 
return backend;
 
 out_launcher:
+   free(param->device);
weston_launcher_destroy(compositor->launcher);
 
 out_udev:
@@ -857,10 +938,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
c

Re: Upcoming release

2019-01-21 Thread nerdopolis
On Friday, January 18, 2019 5:20:40 PM EST Derek Foreman wrote:
> Hi all,
> 
> It's been quite some time since our last weston release, and there's
> been some discussion of getting the next one out in the January to March
> timeframe (this would be the last release to have an autotools build, btw).
> 
> Does anyone have objections to an early February freeze and a March
> release?  Anyone with large series near completion?
> 
> Also, I'd like to float the idea of removing the fbdev backend for this
> release (or the next).  The bulk of the interesting features target the
> drm backend, and it feels like fbdev can sometimes be a bit of a pain to
> update when changes are required elsewhere.  Any strong opinions either way?
> 
> Thanks,
> Derek
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 

I feel like the fbdev backend is a good fallback still. Maybe not for Virtual
Box anymore, since there is now a driver for it in Mainline (I haven't tested
it personally though) ...Currently the Framebuffer backend is the only way to
get Weston working on some obscure hardware such as UDL/DisplayLink2 devices.



___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Fbdev-backend removal from Weston (Re: Upcoming release)

2019-01-22 Thread nerdopolis
On Tuesday, January 22, 2019 9:55:15 AM EST Pekka Paalanen wrote:
> Let's make the title more catchy, so that people who care about fbdev
> would notice.
> 
> 
> On Tue, 22 Jan 2019 10:17:32 +0200
> Pekka Paalanen  wrote:
> 
> > On Mon, 21 Jan 2019 20:30:52 -0500
> > nerdopolis  wrote:
> > 
> > > On Friday, January 18, 2019 5:20:40 PM EST Derek Foreman wrote:  
> > > > Also, I'd like to float the idea of removing the fbdev backend for this
> > > > release (or the next).  The bulk of the interesting features target the
> > > > drm backend, and it feels like fbdev can sometimes be a bit of a pain to
> > > > update when changes are required elsewhere.  Any strong opinions either 
> > > > way?  
> > 
> > > I feel like the fbdev backend is a good fallback still. Maybe not for 
> > > Virtual
> > > Box anymore, since there is now a driver for it in Mainline (I haven't 
> > > tested
> > > it personally though) ...Currently the Framebuffer backend is the only 
> > > way to
> > > get Weston working on some obscure hardware such as UDL/DisplayLink2 
> > > devices.  
> > 
> > Hi,
> > 
> > do you actually have a use case for that? It's ok if you do, we can
> > keep it around for some more, but the simple fact that some hardware
> > exists that does not have a working DRM driver is not enough. There
> > should be users too.
> > 
> > The fbdev-backend certainly has its shortcomings, and I don't mean just
> > the lack of multi-output or monitor hotplug or GPU acceleration or
> > tearing or timings based on nothing but timers; I recall VT-switching
> > being broken for years now, and it doesn't (cannot?) use logind to open
> > the FB devices. Did I forget some?
> > 
> > 
> > Thanks,
> > pq
> 

Hi

Well, TBH, It's just my quazi-distribution Live CD that I still maintain...
It falls back to the Framebuffer on systems (or seats) that don't have 
Kernel Mode Setting. The number of users now probably is low...

VT switching works great. It works without weston-launch, and I can switch away
to a second instance of Weston using the Framebuffer, without them stepping on
each other, and I can switch back to the original one, and it continues working


I do have to create a udev file that sets
SUBSYSTEM=="graphics", KERNEL=="fb*", TAG+="uaccess"
though...


Thanks


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Fbdev-backend removal from Weston (Re: Upcoming release)

2019-01-23 Thread nerdopolis
On Wednesday, January 23, 2019 4:09:44 AM EST Pekka Paalanen wrote:
> On Tue, 22 Jan 2019 22:46:02 -0500
> nerdopolis  wrote:
> 
> > On Tuesday, January 22, 2019 9:55:15 AM EST Pekka Paalanen wrote:
> 
> > > 
> > > On Tue, 22 Jan 2019 10:17:32 +0200
> > > Pekka Paalanen  wrote:
> > >   
> > > > Hi,
> > > > 
> > > > do you actually have a use case for that? It's ok if you do, we can
> > > > keep it around for some more, but the simple fact that some hardware
> > > > exists that does not have a working DRM driver is not enough. There
> > > > should be users too.
> > > > 
> > > > The fbdev-backend certainly has its shortcomings, and I don't mean just
> > > > the lack of multi-output or monitor hotplug or GPU acceleration or
> > > > tearing or timings based on nothing but timers; I recall VT-switching
> > > > being broken for years now, and it doesn't (cannot?) use logind to open
> > > > the FB devices. Did I forget some?
> 
> > 
> > Hi
> > 
> > Well, TBH, It's just my quazi-distribution Live CD that I still maintain...
> > It falls back to the Framebuffer on systems (or seats) that don't have 
> > Kernel Mode Setting. The number of users now probably is low...
> 
> Right. Would you be able to do a test? Disable fbdev on your distro and
> see if anyone complains?
> 
TBH, the user base is likely not as high as it was in 2012. It's prime focus
was to allow users to test anything Wayland live. So I don't think that would
be a good way to tell, since now there are other more popular ways people have
been using it now.
> In fact, would be nice if all distributions did that test. I'm not in
> that much hurry to delete the backend yet.
> 
> > VT switching works great. It works without weston-launch, and I can switch 
> > away
> > to a second instance of Weston using the Framebuffer, without them stepping 
> > on
> > each other, and I can switch back to the original one, and it continues 
> > working
> > 
> > I do have to create a udev file that sets
> > SUBSYSTEM=="graphics", KERNEL=="fb*", TAG+="uaccess"
> > though...
> 
> Yes, that rule or similar is required because logind does not deal fb
> devices IIRC and Weston certainly doesn't ask.
> 
> Are you relying on logind or running Weston privileged to have VT
> switching working?
> 
I am making no changes to logind. I am not running Weston as root. I am not
even granting the plugdev group access to the /dev/fbX devices (It's a "hidden"
boot option, disabled by default). Just systemd-run that starts it as a User
account.
> It's been a long time since I tried VT-switching with fbdev, but it
> didn't work with logind back then:
> https://gitlab.freedesktop.org/wayland/weston/issues/78
> Could it have been fixed in logind instead?
>
Yeah, I wasnt even aware of that one. It was probably logind. Weston is working
fine. I can switch between the framebuffer backed login greeter, and a frame
buffer backed login session, and they don't draw on each other. Weston even
logs when the session becomes active and inactive, so it is aware.

It even works on seats that do NOT have TTYs, since my login manager is
multiseat aware now, I can test that :)
> 
> Thanks,
> pq




___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Starting Weston drm-backend from non-seat0 ?

2017-08-02 Thread nerdopolis
Hi

I found out how to get the systemd session-seat to be my desired seat (with
--setenv=XDG_SEAT=seatx of which pam_systemd.so responds to) After assigning 
devices to the seat, and trying to start it I get "logind: session not running 
on a VT"
Of which is a bit confusing as as far as I understand, VTs only work for seat0.
Trying to start it on a tty with the XDG_SEAT and TTYPath results in a failure 
that seatx is not seat0)

Is there something I am missing?

Thanks
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Starting Weston drm-backend from non-seat0 ?

2017-08-07 Thread nerdopolis
On Wednesday, August 2, 2017 11:09:44 PM EDT nerdopolis wrote:
> Hi
> 
> I found out how to get the systemd session-seat to be my desired seat (with
> --setenv=XDG_SEAT=seatx of which pam_systemd.so responds to) After assigning 
> devices to the seat, and trying to start it I get "logind: session not 
> running 
> on a VT"
> Of which is a bit confusing as as far as I understand, VTs only work for 
> seat0.
> Trying to start it on a tty with the XDG_SEAT and TTYPath results in a 
> failure 
> that seatx is not seat0)
> 
> Is there something I am missing?
> 
> Thanks
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
Is it currently not possible to start Weston on seat1 , since it needs a TTY?

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] libweston: Support autodetection of the current XDG_SEAT

2017-08-15 Thread nerdopolis
On Tuesday, August 15, 2017 3:36:48 PM EDT Armin Krezović wrote:
> On 15.08.2017 04:02, nerdopolis wrote:
> 
> Hi,
> 
> > ---
> >   libweston/compositor-drm.c   | 5 +
> >   libweston/compositor-fbdev.c | 5 +
> >   2 files changed, 10 insertions(+)
> > 
> > diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> > index 10adb463..44b2e448 100644
> > --- a/libweston/compositor-drm.c
> > +++ b/libweston/compositor-drm.c
> > @@ -3502,8 +3502,13 @@ drm_backend_create(struct weston_compositor 
> > *compositor,
> > struct udev_device *drm_device;
> > struct wl_event_loop *loop;
> > const char *seat_id = default_seat;
> > +   const char *session_seat;
> > int ret;
> >   
> > +   session_seat=getenv("XDG_SEAT");
> > +   if (session_seat)
> > +   seat_id=session_seat;
> > +
> 
> seat_id can already be overriden, using --seat=whatever weston option, as 
> seen here:
> 
> https://cgit.freedesktop.org/wayland/weston/tree/compositor/main.c#n1224
> https://cgit.freedesktop.org/wayland/weston/tree/libweston/compositor-drm.c#n3549
> 
> Not sure if there's same thing for fbdev backend, but even if there's not, it 
> should
> be implemented the same way.
> 
> > weston_log("initializing drm backend\n");
> >   
> > b = zalloc(sizeof *b);
> > diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> > index e80a5040..81e5ec3b 100644
> > --- a/libweston/compositor-fbdev.c
> > +++ b/libweston/compositor-fbdev.c
> > @@ -712,6 +712,11 @@ fbdev_backend_create(struct weston_compositor 
> > *compositor,
> >   {
> > struct fbdev_backend *backend;
> > const char *seat_id = default_seat;
> > +   const char *session_seat;
> > +
> > +   session_seat=getenv("XDG_SEAT");
> > +   if (session_seat)
> > +   seat_id=session_seat;
> >   
> > weston_log("initializing fbdev backend\n");
> >   
> > 
> 
> 

Hi
pam_systemd.so sets the XDG_SEAT variable though
So if you're starting Weston where the session_seat is seat1, weston won't 
start, unless you specify --seat=$XDG_SEAT

Which is OK, but then login managers would need to be aware of that when 
starting Weston
Thanks
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] libweston: Support autodetection of the current XDG_SEAT

2017-08-16 Thread nerdopolis
On Wednesday, August 16, 2017 4:50:15 AM EDT Pekka Paalanen wrote:
> On Tue, 15 Aug 2017 18:03:10 -0400
> nerdopolis  wrote:
> 
> > On Tuesday, August 15, 2017 3:36:48 PM EDT Armin Krezović wrote:
> > > On 15.08.2017 04:02, nerdopolis wrote:
> > > 
> > > Hi,
> > >   
> > > > ---
> > > >   libweston/compositor-drm.c   | 5 +
> > > >   libweston/compositor-fbdev.c | 5 +
> > > >   2 files changed, 10 insertions(+)
> > > > 
> > > > diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> > > > index 10adb463..44b2e448 100644
> > > > --- a/libweston/compositor-drm.c
> > > > +++ b/libweston/compositor-drm.c
> > > > @@ -3502,8 +3502,13 @@ drm_backend_create(struct weston_compositor 
> > > > *compositor,
> > > > struct udev_device *drm_device;
> > > > struct wl_event_loop *loop;
> > > > const char *seat_id = default_seat;
> > > > +   const char *session_seat;
> > > > int ret;
> > > >   
> > > > +   session_seat=getenv("XDG_SEAT");
> > > > +   if (session_seat)
> > > > +   seat_id=session_seat;
> > > > +  
> > > 
> > > seat_id can already be overriden, using --seat=whatever weston option, as 
> > > seen here:
> > > 
> > > https://cgit.freedesktop.org/wayland/weston/tree/compositor/main.c#n1224
> > > https://cgit.freedesktop.org/wayland/weston/tree/libweston/compositor-drm.c#n3549
> > > 
> > > Not sure if there's same thing for fbdev backend, but even if there's 
> > > not, it should
> > > be implemented the same way.
> > >   
> > > > weston_log("initializing drm backend\n");
> > > >   
> > > > b = zalloc(sizeof *b);
> > > > diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> > > > index e80a5040..81e5ec3b 100644
> > > > --- a/libweston/compositor-fbdev.c
> > > > +++ b/libweston/compositor-fbdev.c
> > > > @@ -712,6 +712,11 @@ fbdev_backend_create(struct weston_compositor 
> > > > *compositor,
> > > >   {
> > > > struct fbdev_backend *backend;
> > > > const char *seat_id = default_seat;
> > > > +   const char *session_seat;
> > > > +
> > > > +   session_seat=getenv("XDG_SEAT");
> > > > +   if (session_seat)
> > > > +   seat_id=session_seat;
> > > >   
> > > > weston_log("initializing fbdev backend\n");
> > > >   
> > > >   
> > > 
> > >   
> > 
> > Hi
> > pam_systemd.so sets the XDG_SEAT variable though
> > So if you're starting Weston where the session_seat is seat1, weston
> > won't start, unless you specify --seat=$XDG_SEAT
> > 
> > Which is OK, but then login managers would need to be aware of that
> > when starting Weston
> 
> Hi,
> 
> yeah, I think using XDG_SEAT by default if set would be nice, but the
> command line option must override that. I didn't read the patch
> carefully enough to see if it does. Probably could add a sentence in
> the man page and the weston --help output too.
> 
> 
> Thanks,
> pq
Hi. 

I will change the man and help output... ...as of now with this patch, the
--seat option does win over the XDG_SEAT variable

Thanks
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 2/2] Document the new handling of XDG_SEAT

2017-08-18 Thread nerdopolis
---
 compositor/main.c  | 2 +-
 man/weston-drm.man | 7 +--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index f8a60e97..f632fc0e 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -563,7 +563,7 @@ usage(int error_code)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
"  --connector=ID\tBring up only this connector\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
"  --current-mode\tPrefer current KMS mode over EDID preferred 
mode\n\n");
diff --git a/man/weston-drm.man b/man/weston-drm.man
index 35d62ae6..cc43c31a 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -99,8 +99,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in
+. BR XDG_SEAT .
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -122,6 +122,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.11.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 1/2] libweston: Support autodetection of the current XDG_SEAT

2017-08-18 Thread nerdopolis
---
 libweston/compositor-drm.c   | 5 +
 libweston/compositor-fbdev.c | 5 +
 2 files changed, 10 insertions(+)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 10adb463..44b2e448 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3502,8 +3502,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat=getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id=session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index e80a5040..81e5ec3b 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -712,6 +712,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat=getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id=session_seat;
 
weston_log("initializing fbdev backend\n");
 
-- 
2.11.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] libweston: Only check for a VT on seat0, as only seat0 has VTs

2017-08-26 Thread nerdopolis
---
 libweston/launcher-logind.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..7cc6f963 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+if (!strcmp(t, "seat0") {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] libweston: Only check for a VT on seat0, as only seat0 has VTs

2017-08-26 Thread nerdopolis
---
 libweston/launcher-logind.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..11627590 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 6/6] main: don't configure /dev/fb0 by default

2017-09-05 Thread nerdopolis
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index f88608cd..cd07a6bb 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1450,9 +1450,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-09-05 Thread nerdopolis
---
 compositor/main.c| 2 +-
 libweston/compositor-drm.c   | 5 +
 libweston/compositor-fbdev.c | 5 +
 man/weston-drm.man   | 7 +--
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 0615d87e..61bda282 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -562,7 +562,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
"  --current-mode\tPrefer current KMS mode over EDID preferred 
mode\n\n");
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 1a961389..a9f81fba 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3969,8 +3969,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat=getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id=session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 6a305385..dabacbb5 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -723,6 +723,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat=getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id=session_seat;
 
weston_log("initializing fbdev backend\n");
 
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d7fd5614..28cd6e87 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -94,8 +94,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in
+. BR XDG_SEAT .
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -117,6 +117,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 4/6] libweston: fbdev: set fb device info upon the first run. This attempts to wake up secondary framebuffer devices (/dev/fb1 and up) as usually these devices start powered off, and the FBIOPU

2017-09-05 Thread nerdopolis
-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index b4f0685c..a9cc08be 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -356,6 +356,13 @@ fbdev_frame_buffer_open(struct fbdev_output *output, const 
char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(output, fd,
+ &output->fb_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
/* Grab the screen info. */
if (fbdev_query_screen_info(output, fd, screen_info) < 0) {
weston_log("Failed to get frame buffer info: %s\n",
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat, instead of defaulting to /dev/fb0

2017-09-05 Thread nerdopolis
---
 libweston/compositor-fbdev.c | 35 +--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index a9cc08be..99362b8a 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -732,6 +732,12 @@ fbdev_backend_create(struct weston_compositor *compositor,
const char *seat_id = default_seat;
const char *session_seat;
 
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+char *fb_device;
+   struct udev_device *device;
+
session_seat=getenv("XDG_SEAT");
if (session_seat)
seat_id=session_seat;
@@ -755,6 +761,33 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   e = udev_enumerate_new(backend->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(backend->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (!strcmp(device_seat, seat_id)) {
+   fb_device = udev_device_get_devnode(device);
+   if (fb_device && !param->device)
+   param->device = strdup(fb_device);
+   udev_device_unref(device);
+   udev_enumerate_unref(e);
+   break;
+   }
+   }
+   if (!param->device)
+   param->device=strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -802,8 +835,6 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
config->seat_id = "seat0"; /* default seat*/
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 2/6] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2017-09-05 Thread nerdopolis
---
 compositor/main.c| 2 ++
 libweston/compositor-fbdev.c | 5 -
 libweston/compositor-fbdev.h | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 61bda282..f88608cd 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -573,6 +573,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1444,6 +1445,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index dabacbb5..b4f0685c 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -728,6 +728,8 @@ fbdev_backend_create(struct weston_compositor *compositor,
session_seat=getenv("XDG_SEAT");
if (session_seat)
seat_id=session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -751,7 +753,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run "
   "using weston-launch binary or as root\n");
@@ -797,6 +799,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = "seat0"; /* default seat*/
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..c4e3305a 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -43,6 +43,7 @@ struct weston_fbdev_backend_config {
 
int tty;
char *device;
+   char *seat_id;
 
/** Callback used to configure input devices.
 *
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2017-09-05 Thread nerdopolis
---
 libweston/launcher-logind.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..11627590 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 0/6] libweston: Support multiple seats better

2017-09-06 Thread nerdopolis
I am resending as I messed up one of the commit messages, which resulted
in a very long subject by mistake. These patches fix issues with Weston
where it supports multiple seats better. 

Firstly supporting automatically detecting the seat to use, by using the
XDG_SEAT variable set by logind if the --seat option is not specified.

And then improving the fbdev-backend to support the --seat option and
not hard use seat0

And then to not have weston try to use a TTY when it's not running 
on seat0, as only seat0 can have TTYs

And also attempt to turn on a framebuffer device on, as many secondary
video cards that support DRM/KMS, such as qemu's bochs, and udl start 
off powered off, and don't turn on the screens until the ioctl is sent

Then finally, make the fbdev-backend detect the first framebuffer device
assigned to the current seat with udev (I based that largely off of some
of drm-backend)

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-09-06 Thread nerdopolis
---
 compositor/main.c| 2 +-
 libweston/compositor-drm.c   | 5 +
 libweston/compositor-fbdev.c | 5 +
 man/weston-drm.man   | 7 +--
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 0615d87e..61bda282 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -562,7 +562,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
"  --current-mode\tPrefer current KMS mode over EDID preferred 
mode\n\n");
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 1a961389..a9f81fba 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3969,8 +3969,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat=getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id=session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 6a305385..dabacbb5 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -723,6 +723,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat=getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id=session_seat;
 
weston_log("initializing fbdev backend\n");
 
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d7fd5614..28cd6e87 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -94,8 +94,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in
+. BR XDG_SEAT .
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -117,6 +117,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2017-09-06 Thread nerdopolis
---
 libweston/launcher-logind.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..11627590 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2017-09-06 Thread nerdopolis
---
 libweston/compositor-fbdev.c | 35 +--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index a9cc08be..99362b8a 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -732,6 +732,12 @@ fbdev_backend_create(struct weston_compositor *compositor,
const char *seat_id = default_seat;
const char *session_seat;
 
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+char *fb_device;
+   struct udev_device *device;
+
session_seat=getenv("XDG_SEAT");
if (session_seat)
seat_id=session_seat;
@@ -755,6 +761,33 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   e = udev_enumerate_new(backend->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(backend->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (!strcmp(device_seat, seat_id)) {
+   fb_device = udev_device_get_devnode(device);
+   if (fb_device && !param->device)
+   param->device = strdup(fb_device);
+   udev_device_unref(device);
+   udev_enumerate_unref(e);
+   break;
+   }
+   }
+   if (!param->device)
+   param->device=strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -802,8 +835,6 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
config->seat_id = "seat0"; /* default seat*/
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 2/6] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2017-09-06 Thread nerdopolis
---
 compositor/main.c| 2 ++
 libweston/compositor-fbdev.c | 5 -
 libweston/compositor-fbdev.h | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 61bda282..f88608cd 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -573,6 +573,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1444,6 +1445,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index dabacbb5..b4f0685c 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -728,6 +728,8 @@ fbdev_backend_create(struct weston_compositor *compositor,
session_seat=getenv("XDG_SEAT");
if (session_seat)
seat_id=session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -751,7 +753,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run "
   "using weston-launch binary or as root\n");
@@ -797,6 +799,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = "seat0"; /* default seat*/
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..c4e3305a 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -43,6 +43,7 @@ struct weston_fbdev_backend_config {
 
int tty;
char *device;
+   char *seat_id;
 
/** Callback used to configure input devices.
 *
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 4/6] libweston: fbdev: set fb device info upon the first run.

2017-09-06 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index b4f0685c..a9cc08be 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -356,6 +356,13 @@ fbdev_frame_buffer_open(struct fbdev_output *output, const 
char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(output, fd,
+ &output->fb_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
/* Grab the screen info. */
if (fbdev_query_screen_info(output, fd, screen_info) < 0) {
weston_log("Failed to get frame buffer info: %s\n",
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 6/6] main: don't configure /dev/fb0 by default

2017-09-06 Thread nerdopolis
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index f88608cd..cd07a6bb 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1450,9 +1450,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 4/6] libweston: fbdev: set fb device info upon the first run.

2017-09-14 Thread nerdopolis
On Wednesday, September 6, 2017 8:17:21 AM EDT nerdopolis wrote:
> This attempts to wake up secondary framebuffer devices
> (/dev/fb1 and up) as usually these devices start powered off, and
> the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
> qemu system with the options:
> 
> -vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
> -device secondary-vga,id=video2
> ---
>  libweston/compositor-fbdev.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> index b4f0685c..a9cc08be 100644
> --- a/libweston/compositor-fbdev.c
> +++ b/libweston/compositor-fbdev.c
> @@ -356,6 +356,13 @@ fbdev_frame_buffer_open(struct fbdev_output *output, 
> const char *fb_dev,
>   return -1;
>   }
>  
> + /* Attempt to correct the framebuffer settings */
> + if (fbdev_set_screen_info(output, fd,
> +   &output->fb_info) < 0) {
> + weston_log("Failed to set mode settings. "
> +"Attempting to open output anyway.\n");
> + }
> +
>   /* Grab the screen info. */
>   if (fbdev_query_screen_info(output, fd, screen_info) < 0) {
>   weston_log("Failed to get frame buffer info: %s\n",
> 
Hi

Nix this one, I tried it on a UDL (USB display link device) framebuffer, and it
changes the resolution/vsync that my screen cannot handle, and I'll need to 
figure out why it does that (as UDL (the framebuffer only one) starts off) with
the screen all green...

...It worked for QEMU, but not for real hardware

Sorry about this...
...I'll try to see what I can come up with, and why it does that
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2017-09-30 Thread nerdopolis
On Tuesday, September 26, 2017 10:00:47 AM EDT Pekka Paalanen wrote:
> On Wed,  6 Sep 2017 08:17:22 -0400
> nerdopolis  wrote:
> 
> > ---
> >  libweston/compositor-fbdev.c | 35 +--
> >  1 file changed, 33 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> > index a9cc08be..99362b8a 100644
> > --- a/libweston/compositor-fbdev.c
> > +++ b/libweston/compositor-fbdev.c
> > @@ -732,6 +732,12 @@ fbdev_backend_create(struct weston_compositor 
> > *compositor,
> > const char *seat_id = default_seat;
> > const char *session_seat;
> >  
> > +   struct udev_enumerate *e;
> > +   struct udev_list_entry *entry;
> > +   const char *path, *device_seat;
> > +char *fb_device;
> 
> Use tabs.
> 
> > +   struct udev_device *device;
> > +
> > session_seat=getenv("XDG_SEAT");
> > if (session_seat)
> > seat_id=session_seat;
> > @@ -755,6 +761,33 @@ fbdev_backend_create(struct weston_compositor 
> > *compositor,
> > goto out_compositor;
> > }
> >  
> > +   e = udev_enumerate_new(backend->udev);
> > +   udev_enumerate_add_match_subsystem(e, "graphics");
> > +   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
> > +
> > +   udev_enumerate_scan_devices(e);
> > +   fb_device = NULL;
> > +   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
> > +
> > +   path = udev_list_entry_get_name(entry);
> > +   device = udev_device_new_from_syspath(backend->udev, path);
> > +   if (!device)
> > +   continue;
> > +   device_seat = udev_device_get_property_value(device, "ID_SEAT");
> > +   if (!device_seat)
> > +   device_seat = default_seat;
> > +   if (!strcmp(device_seat, seat_id)) {
> > +   fb_device = udev_device_get_devnode(device);
> > +   if (fb_device && !param->device)
> > +   param->device = strdup(fb_device);
> > +   udev_device_unref(device);
> > +   udev_enumerate_unref(e);
> > +   break;
> > +   }
> > +   }
> 
> If you put all the above in a new function, you could skip it all when
> param->device is already set. Just a thought.
> 
> > +   if (!param->device)
> > +   param->device=strdup("/dev/fb0");
> > +
> > /* Set up the TTY. */
> > backend->session_listener.notify = session_notify;
> > wl_signal_add(&compositor->session_signal,
> > @@ -802,8 +835,6 @@ out_compositor:
> >  static void
> >  config_init_to_defaults(struct weston_fbdev_backend_config *config)
> >  {
> > -   /* TODO: Ideally, available frame buffers should be enumerated using
> > -* udev, rather than passing a device node in as a parameter. */
> > config->tty = 0; /* default to current tty */
> > config->device = "/dev/fb0"; /* default frame buffer */
> > config->seat_id = "seat0"; /* default seat*/
> 
> I see the following patch removes the default setting of device from
> main.c, but it should removed from here as well, for the same reasons
> as in patch 2 for seat_id.
> 
> This patch looks ok, but is again missing the rationale on why we want
> this.
> 
> I understand this is part of the whole make seats work with fbdev
> backend, but why care so much about the fbdev backend?
> 
> 
> Thanks,
> pq
Thanks for the review.

I care about the fbdev backend because of the support for DisplayLink devices.
I don't think I can am good enough where I can fix *those* problems with Kernel
Mode setting... ...and as far as multi seat goes, USB devices are probably the 
most suitable for supporting multiseat setups (as opposed to multi PCI cards)


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-10-02 Thread nerdopolis
On Tuesday, September 26, 2017 9:17:37 AM EDT you wrote:
> On Wed,  6 Sep 2017 08:17:18 -0400
> nerdopolis  wrote:
> 
> > ---
> 
> Hi,
> 
> the commit message should contain at least briefly why we want this. I
> have a feeling this is the right thing to do, but I can't quite put the
> reason into words myself.
> 
> We would also prefer a Signed-off-by line in all patches, with your
> real name and email.
> 
I am trying to reduce the number of times my real name appears in Google 
though...
> >  compositor/main.c| 2 +-
> >  libweston/compositor-drm.c   | 5 +
> >  libweston/compositor-fbdev.c | 5 +
> >  man/weston-drm.man   | 7 +--
> >  4 files changed, 16 insertions(+), 3 deletions(-)
> > 
> > diff --git a/compositor/main.c b/compositor/main.c
> > index 0615d87e..61bda282 100644
> > --- a/compositor/main.c
> > +++ b/compositor/main.c
> > @@ -562,7 +562,7 @@ usage(int error_code)
> >  #if defined(BUILD_DRM_COMPOSITOR)
> > fprintf(stderr,
> > "Options for drm-backend.so:\n\n"
> > -   "  --seat=SEAT\t\tThe seat that weston should run on\n"
> > +   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
> > of the seat defined in XDG_SEAT\n"
> > "  --tty=TTY\t\tThe tty to use\n"
> > "  --use-pixman\t\tUse the pixman (CPU) renderer\n"
> > "  --current-mode\tPrefer current KMS mode over EDID preferred 
> > mode\n\n");
> > diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> > index 1a961389..a9f81fba 100644
> > --- a/libweston/compositor-drm.c
> > +++ b/libweston/compositor-drm.c
> > @@ -3969,8 +3969,13 @@ drm_backend_create(struct weston_compositor 
> > *compositor,
> > struct udev_device *drm_device;
> > struct wl_event_loop *loop;
> > const char *seat_id = default_seat;
> > +   const char *session_seat;
> > int ret;
> >  
> > +   session_seat=getenv("XDG_SEAT");
> > +   if (session_seat)
> > +   seat_id=session_seat;
> 
> Needs spaces around operators.
> 
> > +
> > weston_log("initializing drm backend\n");
> >  
> > b = zalloc(sizeof *b);
> > diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> > index 6a305385..dabacbb5 100644
> > --- a/libweston/compositor-fbdev.c
> > +++ b/libweston/compositor-fbdev.c
> > @@ -723,6 +723,11 @@ fbdev_backend_create(struct weston_compositor 
> > *compositor,
> >  {
> > struct fbdev_backend *backend;
> > const char *seat_id = default_seat;
> > +   const char *session_seat;
> > +
> > +   session_seat=getenv("XDG_SEAT");
> > +   if (session_seat)
> > +   seat_id=session_seat;
> 
> Spaces around operators.
> 
> >  
> > weston_log("initializing fbdev backend\n");
> >  
> > diff --git a/man/weston-drm.man b/man/weston-drm.man
> > index d7fd5614..28cd6e87 100644
> > --- a/man/weston-drm.man
> > +++ b/man/weston-drm.man
> > @@ -94,8 +94,8 @@ switching to the monitor preferred mode.
> >  \fB\-\-seat\fR=\fIseatid\fR
> >  Use graphics and input devices designated for seat
> >  .I seatid
> > -instead of the default seat
> > -.BR seat0 .
> > +instead of the seat defined in
> > +. BR XDG_SEAT .
> 
> Would be nice to mention it is a environment variable, and if it is not
> set, then falling back to "seat0".
> 
> >  .TP
> >  \fB\-\-tty\fR=\fIx\fR
> >  Launch Weston on tty
> > @@ -117,6 +117,9 @@ The file descriptor (integer) where
> >  .B weston-launch
> >  is listening. Automatically set by
> >  .BR weston-launch .
> > +.TP
> > +.B XDG_SEAT
> > +The seat that Weston will start on.
> >  .
> >  .\" ***
> >  .SH "SEE ALSO"
> 
> It is very nice to remember to update the manuals. :-)
> 
> A nice improvement. I think this patch should be split: one patch for
> DRM-backend, another fbdev-backend, especially as this patch does not
> actually make fbdev backend use XDG_SEAT - it's the next patch that
> does.
> 
> 
> Thanks,
> pq


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 4/6] libweston: fbdev: set fb device info upon the first run.

2017-10-02 Thread nerdopolis
On Tuesday, September 26, 2017 9:45:43 AM EDT Pekka Paalanen wrote:
> On Thu, 14 Sep 2017 23:08:51 -0400
> nerdopolis  wrote:
> 
> > On Wednesday, September 6, 2017 8:17:21 AM EDT nerdopolis wrote:
> > > This attempts to wake up secondary framebuffer devices
> > > (/dev/fb1 and up) as usually these devices start powered off, and
> > > the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
> > > qemu system with the options:
> > > 
> > > -vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
> > > -device secondary-vga,id=video2
> > > ---
> > >  libweston/compositor-fbdev.c | 7 +++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> > > index b4f0685c..a9cc08be 100644
> > > --- a/libweston/compositor-fbdev.c
> > > +++ b/libweston/compositor-fbdev.c
> > > @@ -356,6 +356,13 @@ fbdev_frame_buffer_open(struct fbdev_output *output, 
> > > const char *fb_dev,
> > >   return -1;
> > >   }
> > >  
> > > + /* Attempt to correct the framebuffer settings */
> > > + if (fbdev_set_screen_info(output, fd,
> > > +   &output->fb_info) < 0) {
> > > + weston_log("Failed to set mode settings. "
> > > +"Attempting to open output anyway.\n");
> > > + }
> > > +
> > >   /* Grab the screen info. */
> > >   if (fbdev_query_screen_info(output, fd, screen_info) < 0) {
> > >   weston_log("Failed to get frame buffer info: %s\n",
> > >   
> > Hi
> > 
> > Nix this one, I tried it on a UDL (USB display link device) framebuffer, 
> > and it
> > changes the resolution/vsync that my screen cannot handle, and I'll need to 
> > figure out why it does that (as UDL (the framebuffer only one) starts off) 
> > with
> > the screen all green...
> > 
> > ...It worked for QEMU, but not for real hardware
> > 
> > Sorry about this...
> > ...I'll try to see what I can come up with, and why it does that
> 
> Hi,
> 
> yeah, we definitely do not want to set_screen_info before first
> query_screen_info. If there is something valid set already, we want to
> keep it. If there is not, then how do you know what to set?
> 
> What screen info values do you think this patch is setting? All
> zeroes? ;-)
> 
Thanks for all the reviews!

This was an attempt to use the fact that set_screen_info sends the 
FBIOPUT_VSCREENINFO ioctl, which turns on the screen (if it's a /dev/fb1 as 
those usually are off upon boot. At least with the DisplayLink devices, and 
secondary-vga devices I've tested on)

I seem to have fixed this, It works on my QEMU configuration I mentioned,
it does not throw my screen out of wack on real hardware, but I think there is 
a bug with UDL (displaylink) or something where Plymouth starts, and freezes 
the display, and prevents the framebuffer from displaying (even when I cat 
/dev/urandom
into /dev/fb1 as a test...

This is with the udl driver (not udlfb), ...and this might be out of the
concern of Weston.
> 
> Thanks,
> pq


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 6/6] main: don't configure /dev/fb0 by default

2017-10-03 Thread nerdopolis
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index f88608cd..cd07a6bb 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1450,9 +1450,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2017-10-03 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, use udev to find the
first framebuffer device in the seat.
---
 libweston/compositor-fbdev.c | 45 +---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index da841b7c..3d57ce61 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -727,6 +727,42 @@ fbdev_restore(struct weston_compositor *compositor)
weston_launcher_restore(compositor->launcher);
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+   char *fb_device;
+   struct udev_device *device;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (!strcmp(device_seat, seat)) {
+   fb_device = udev_device_get_devnode(device);
+   udev_enumerate_unref(e);
+   break;
+   }
+   udev_device_unref(device);
+   }
+
+   udev_enumerate_unref(e);
+   return fb_device;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -758,6 +794,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device=strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -805,10 +846,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-10-03 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  | 2 +-
 libweston/compositor-drm.c | 5 +
 man/weston-drm.man | 7 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 0615d87e..61bda282 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -562,7 +562,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
"  --current-mode\tPrefer current KMS mode over EDID preferred 
mode\n\n");
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 5e87cb41..e791bb7a 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3982,8 +3982,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d7fd5614..17c1ad31 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -94,8 +94,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -117,6 +117,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 2/6] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2017-10-03 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 61bda282..f88608cd 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -573,6 +573,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1444,6 +1445,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 62ffa0ba..7355ec24 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -725,6 +725,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -748,7 +755,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run "
   "using weston-launch binary or as root\n");
@@ -794,6 +801,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..ca76a902 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,7 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2017-10-03 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 22 --
 libweston/launcher-util.c   |  4 
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..a94ec0e9 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index fa3ed13b..848c6ade 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -111,6 +111,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) == 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 4/6] libweston: fbdev: set fb device info upon the first run.

2017-10-03 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 7355ec24..da841b7c 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -364,6 +364,14 @@ fbdev_frame_buffer_open(struct fbdev_output *output, const 
char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(output, fd,
+ screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2017-10-07 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  | 2 +-
 libweston/compositor-drm.c | 5 +
 man/weston-drm.man | 7 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 0615d87e..61bda282 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -562,7 +562,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
"  --current-mode\tPrefer current KMS mode over EDID preferred 
mode\n\n");
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index b641d61e..0025f5ba 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4002,8 +4002,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d7fd5614..17c1ad31 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -94,8 +94,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -117,6 +117,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3 6/6] main: don't configure /dev/fb0 by default

2017-10-07 Thread nerdopolis
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index f88608cd..cd07a6bb 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1450,9 +1450,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3 2/6] libweston: fbdev: support the --seat option, (and XDG_SEAT variable)

2017-10-07 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 61bda282..f88608cd 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -573,6 +573,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1444,6 +1445,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "device", 0, &config.device },
+   { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 4b3605cf..2756d587 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -710,6 +710,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -734,7 +741,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(&compositor->session_signal,
  &backend->session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run "
   "using weston-launch binary or as root\n");
@@ -779,6 +786,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..ca76a902 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,7 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3 5/6] libweston: fbdev: Attempt to detect the first framebuffer device in the seat. instead of defaulting to /dev/fb0

2017-10-07 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, use udev to find the
first framebuffer device in the seat.
---
 libweston/compositor-fbdev.c | 45 +---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 18af7082..cad4b202 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -711,6 +711,42 @@ fbdev_restore(struct weston_compositor *compositor)
weston_launcher_restore(compositor->launcher);
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat;
+   char *fb_device;
+   struct udev_device *device;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (!strcmp(device_seat, seat)) {
+   fb_device = udev_device_get_devnode(device);
+   udev_enumerate_unref(e);
+   break;
+   }
+   udev_device_unref(device);
+   }
+
+   udev_enumerate_unref(e);
+   return fb_device;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -743,6 +779,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device=strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
@@ -789,10 +830,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3 4/6] libweston: fbdev: set fb device info upon the first run.

2017-10-07 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 2756d587..18af7082 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -361,6 +361,13 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2017-10-07 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 24 ++--
 libweston/launcher-util.c   |  4 
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index a069bd4f..71f1c465 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,18 +762,22 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   if (!strcmp(t, "seat0")) {
+   r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   free(t);
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   free(t);
+   r = -EINVAL;
+   goto err_session;
+   }
}
+   free(t);
 
loop = wl_display_get_event_loop(compositor->wl_display);
r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index fa3ed13b..848c6ade 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -111,6 +111,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) == 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.14.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 4/6] libweston: fbdev: set fb device info upon the first run.

2017-10-13 Thread nerdopolis
On Tuesday, October 3, 2017 2:44:47 AM EDT Pekka Paalanen wrote:
> On Mon, 02 Oct 2017 23:14:26 -0400
> nerdopolis  wrote:
> 
> > On Tuesday, September 26, 2017 9:45:43 AM EDT Pekka Paalanen wrote:
> > > On Thu, 14 Sep 2017 23:08:51 -0400
> > > nerdopolis  wrote:
> > >   
> > > > On Wednesday, September 6, 2017 8:17:21 AM EDT nerdopolis wrote:  
> > > > > This attempts to wake up secondary framebuffer devices
> > > > > (/dev/fb1 and up) as usually these devices start powered off, and
> > > > > the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
> > > > > qemu system with the options:
> > > > > 
> > > > > -vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
> > > > > -device secondary-vga,id=video2
> > > > > ---
> > > > >  libweston/compositor-fbdev.c | 7 +++
> > > > >  1 file changed, 7 insertions(+)
> > > > > 
> > > > > diff --git a/libweston/compositor-fbdev.c 
> > > > > b/libweston/compositor-fbdev.c
> > > > > index b4f0685c..a9cc08be 100644
> > > > > --- a/libweston/compositor-fbdev.c
> > > > > +++ b/libweston/compositor-fbdev.c
> > > > > @@ -356,6 +356,13 @@ fbdev_frame_buffer_open(struct fbdev_output 
> > > > > *output, const char *fb_dev,
> > > > >   return -1;
> > > > >   }
> > > > >  
> > > > > + /* Attempt to correct the framebuffer settings */
> > > > > + if (fbdev_set_screen_info(output, fd,
> > > > > +   &output->fb_info) < 0) {
> > > > > + weston_log("Failed to set mode settings. "
> > > > > +"Attempting to open output anyway.\n");
> > > > > + }
> > > > > +
> > > > >   /* Grab the screen info. */
> > > > >   if (fbdev_query_screen_info(output, fd, screen_info) < 0) {
> > > > >   weston_log("Failed to get frame buffer info: %s\n",
> > > > > 
> > > > Hi
> > > > 
> > > > Nix this one, I tried it on a UDL (USB display link device) 
> > > > framebuffer, and it
> > > > changes the resolution/vsync that my screen cannot handle, and I'll 
> > > > need to 
> > > > figure out why it does that (as UDL (the framebuffer only one) starts 
> > > > off) with
> > > > the screen all green...
> > > > 
> > > > ...It worked for QEMU, but not for real hardware
> > > > 
> > > > Sorry about this...
> > > > ...I'll try to see what I can come up with, and why it does that  
> > > 
> > > Hi,
> > > 
> > > yeah, we definitely do not want to set_screen_info before first
> > > query_screen_info. If there is something valid set already, we want to
> > > keep it. If there is not, then how do you know what to set?
> > > 
> > > What screen info values do you think this patch is setting? All
> > > zeroes? ;-)
> > >   
> > Thanks for all the reviews!
> > 
> > This was an attempt to use the fact that set_screen_info sends the 
> > FBIOPUT_VSCREENINFO ioctl, which turns on the screen (if it's a /dev/fb1 as 
> > those usually are off upon boot. At least with the DisplayLink devices, and 
> > secondary-vga devices I've tested on)
> > 
> > I seem to have fixed this, It works on my QEMU configuration I mentioned,
> > it does not throw my screen out of wack on real hardware, but I think there 
> > is 
> > a bug with UDL (displaylink) or something where Plymouth starts, and 
> > freezes 
> > the display, and prevents the framebuffer from displaying (even when I cat 
> > /dev/urandom
> > into /dev/fb1 as a test...
> > 
> > This is with the udl driver (not udlfb), ...and this might be out of the
> > concern of Weston.
> 
> Hm, wouldn't Plymouth be using DRM KMS, not fbdev?
> KMS usage will "hide" the fbdev contents by design. A bug in the driver
> is possible, or then the KMS usage in both Weston and Plymouth is
> missing bits, like handling pageflips never working or not setting
> dirty rects or something. Oh yeah, Weston doesn't do multi-card either.
> 
It's a bug in the driver. I have the udl driver as the second card on seat1, so
this is not an issue with weston multi-card. This was more 'I got it to work on
a VM but not quite right on my real hardware, but because it seems to be due to
a lower level issue with the udl driver'.. I tried to turn off plymouth and ran
Weston on the UDL device, and it is just black. seems to be the fb emulation...
> 
> Thanks,
> pq


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: "hosted" patch for nouveau - X under wayland

2010-12-02 Thread nerdopolis
On Sunday, November 28, 2010 02:29:51 AM you wrote:
> Warning:  What I did has broken X in a way that strangely persists across
> reboots.  Might just be that my keyboard and mouse aren't responding, I
> haven't fixed it yet (I'm booted off a CF card).  I also had a hard
> drive crash last night, which probably wasn't directly related.
> 
> 
> Am I correct in believing that I should be able to just run the wayland
> compositor under X, and then run "./Xorg :1" with the "hosted" patches?  I
> got that far with nouveau, and got a black screen and a hung system.  When
> I ran that patched version outside of X it complained about not being able
> to connect to wayland.
> 
> How do I get it to run rootless?
> "./Xorg :1 -rootless" ?
> 
> Oh, there's a -hosted flag.  Hmm.  So "./Xorg :1 -hosted -rootless"?
> 
> 
> Background:
> 
> It's possible to run X.org as a client of wayland, rootless or not, if
> you have an Intel video card:
> http://wayland.freedesktop.org/rootless-x-under-wayland.png
> http://wayland.freedesktop.org/fullscreen-x-compiz.png
> 
> This requires a modified X.org from here:
> http://cgit.freedesktop.org/~krh/xserver/log/?h=hosted
> 
> And a patch to the X.org video driver, here:
> http://cgit.freedesktop.org/~krh/xf86-video-intel/log/?h=hosted
> 
> I attempted to port that patch to the nouveau driver:
> http://www.chaosreigns.com/wayland/nouveau.hosted.git.patch
> 
> 
> Getting it to run goes something like this (assuming you have wayland and
> all its dependencies in $HOME/install):
> 
> git clone git://anongit.freedesktop.org/git/mesa/drm
> cd drm
> ./autogen.sh --prefix=$HOME/install --enable-nouveau-experimental-api
> make
> make install
> cd ..
> 
> git clone git://anongit.freedesktop.org/~krh/xserver --branch hosted
> cd xserver
> ./autogen.sh --prefix=$HOME/install --enable-nouveau-experimental-api
> make
> make install
> cd ..
> 
> wget http://www.chaosreigns.com/wayland/nouveau.hosted.git.patch
> git clone git://anongit.freedesktop.org/nouveau/xf86-video-nouveau
> cd xf86-video-nouveau
> patch -p1 < ../nouveau.hosted.git.patch
> ./autogen.sh --prefix=$HOME/install --enable-nouveau-experimental-api
> make
> make install
> cd ..
> 
> mkdir -p $HOME/install/etc/X11
> echo -e 'Section "Device"\nIdentifier "n"\nDriver "nouveau"\nEndSection' >
> $HOME/install/etc/X11/xorg.conf
> 
> wayland/compositor/compositor &
> sleep 1
> $HOME/install/bin/Xorg :1 -hosted -rootless &
> # Haven't gotten this last one to work.
> 
> 
> I also rebuilt my kernel from the nouveau git repo, under ubuntu maverick:
> 
> git clone --depth 1 git://anongit.freedesktop.org/nouveau/linux-2.6
> cd linux-2.6
> cp /boot/config-`uname -r` .config # use .config of currently running
> kernel yes "" | make oldconfig # use defaults of newer features
> make clean && make && make modules && sudo make modules_install && sudo
> make install mkinitramfs -o initrd.img `make kernelversion`+
> sudo mv initrd.img /boot/initrd.img-`make kernelversion`+
> sudo update-grub
> 
> Reboot.
> 
> 
> Note that the "+"'s in the kernel build steps seem to be a peculiarity of
> the nouveau kernel tree.  I was really amazed it worked that easily, once
> I figured it out.  That kernel directory alone ended up being 6.6
> gigabytes.  The kernel install is nice and clean, creating only two files
> in /boot and a directory in /lib/modules.

I am trying to test the hosted x server (on intel)

I ran
git clone git://anongit.freedesktop.org/~krh/xserver --branch hosted
cd xserver
./autogen.sh 
make
make install
cd ..

and when I try to run

./Xorg  :1 -hosted -rootless

I get

This is a pre-release version of the X server from The X.Org Foundation.
It is not supported in any way.
Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.
Select the "xorg" product for bugs you find in this release.
Before reporting bugs in pre-release versions please check the
latest version in the X.Org Foundation git repository.
See http://wiki.x.org/wiki/GitPage for git access instructions.

X.Org X Server 1.9.99.1
Release Date: 2010-10-01
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.37-7-generic i686 
Current Operating System: Linux nerdopolis 2.6.37-7-generic #19-Ubuntu SMP Tue 
Nov 30 23:46:45 UTC 2010 i686
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.37-7-generic 
root=UUID=9c16ad49-512a-4b06-b539-73cde5b29da2 ro quiet splash i915.modeset=1
Build Date: 02 December 2010  10:26:37PM
 
Current version of pixman: 0.18.4
Before reporting problems, check http://wiki.x.o

RE: "hosted" patch for nouveau - X under wayland

2010-12-03 Thread nerdopolis
Ok. It seems that I will have to build all the drivers... I built intel.

I also noticed another line 

/usr/bin/Xorg: symbol lookup error: 
/usr/lib/xorg/modules/extensions/libhosted.so: undefined symbol: 
wl_display_create

I see some Wayland libraries in /usr/lib, where I now have they new X org 
configured...
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Wayland crash scenario

2010-12-13 Thread nerdopolis
Hi. As far as I know, X apps always had the ability to reconnect, its just 
that none ever did. I don't know why, maybe piximaps or windows states/ID's 
where lost or something... Or the idea never caught on. X apps don't crash 
when they lose connection to the x server, its just that they all (most) 
perform a safe exit action (you can see it in the terminal) and then close, 
instead of looking for a new display.

I don't know if its possible or not, but seeing that its client server, I 
don't see why it would not be. I have a feeling that Wayland clients would be 
able to reconnect, but don't take it from me.

But I agree that this is importiant, If Wayland was to segfault, or if the 
user needs to switch to a new instance of the Wayland server, (because of a 
new version, wanted to switch to a compositor with a different WM style, or 
wanted to leave the desktop session, and remote into the session) it should be 
supported early.

PS I don't know about the last example. It was stated earlier that a custom 
version of Wayland could be made to support remote/remote rootless sessions. 
It would be a great feature If session could be made remote/local on the fly.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Wayland hot-replace server?

2011-03-06 Thread nerdopolis
Hi.

I just want to bring this up for early consideration:

It seems that many things in Wayland will be determined by they type of 
compositor server you are running, such as if you want to have a tiling window 
manager in Wayland, or one that has other features. 

My question is that will users be able to have the ability to change their 
Wayland servers on the fly? not only would such a thing allow the users to 
change functionality, but it will also help in the case if the Wayland server 
goes down, where the session is not lost. 

Will this have to happen in the apps themselves? If so, how would the apps 
"know" that the socket (or maybe even a new socket) is available for 
reconnect? 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


XDG_Shell and wl_probe

2014-02-19 Thread nerdopolis
Hi.


About 10 months or so ago, there where patches submitted by Rob Bradford. I 
chose to ping the list as I think that what they implement is useful to desktop 
users.
http://lists.freedesktop.org/archives/wayland-devel/2013-April/008836.html
http://lists.freedesktop.org/archives/wayland-devel/2013-April/008666.html
http://lists.freedesktop.org/archives/wayland-devel/2013-April/008667.html


They where for giving applications a way of knowing how much of its menu will 
be visible, if it was to display one at a particular size. 

As this can be quite useful for applications that are near the bottom of the 
screen, to have a way of knowing if the menu is going offscreen, and can be 
useful to Desktop users, should this be made part of XDG_Shell as well?
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


ANNOUNCE: New Wayland live CD

2014-03-21 Thread nerdopolis
Hi.


I am announcing new ISOs for my Wayland Live CD, which is named after my 
favorite celebrity.


You can find the new ISOs here:
https://sourceforge.net/projects/rebeccablackos/files/2014-03-21/

Once again, the larger ISO is only larger because it has more development 
headers, binaries with all the symbols, and more software installed to compile 
and download source. The smaller ISO has no other reductions in the user 
experience.

Also please note that all of my checkinstall built packages have the -rbos 
suffix, and mostly reside in /opt. So Wayland master is provided by the 
wayland-rbos package, NOT the libwayland package that comes from the system 
repos for example. 

Except there are small changes that I made for backporting a few things for the 
release
DIFF of the changes to the SVN: http://pastebin.com/sDfA2izd

They currently contain:
  * Wayland Master
  * Weston Master 
  * Wayland enabled Clutter
  * Wayland enabled SDL
  * Wayland enabled GTK
  * Wayland enabled QT
  * Wayland enabled EFL/Elementary
  * Wayland enabled mplayer
  * Wayland enabled gstreamer
  * Orbital for Wayland (selectable at login)   
https://github.com/giucam/orbital
  * Hawaii for Wayland (selectable at login) https://github.com/mauios
  * KDE Frameworks Wayland programs 
  * Native Calligra Wayland programs
  * Wayland enabled Gnome-shell (selectable at login) *Does not work on 
Virtualbox, except it can run nested
  * A graphical utility for configuring udev for weston multiseat/multi pointer
  * A rudimentary but functional Wayland login manager written in Bash, that 
supports user switching and session selection. 
  * Wayland enabled Enlightenment E19 *Does not work on Virtualbox
  *hardcoded screen size
  * SWC tiling Wayland server (use super+enter for terminal, and super+r for 
dmenu) *Does not work on Virtualbox, and does not run nested. Only tested on 
Intel (selectable at login)   https://github.com/michaelforney/swc
  * Menu options to run Gnome Shell Wayland, Enlightenment e19 Wayland, 
Orbital, SWC, and Hawaii desktops as nested sessions. 

-
  More security on KMS supported cards, and will be more secure on FB, once bug 
https://bugs.freedesktop.org/show_bug.cgi?id=73782 is fixed and I remove the 
setfacls from waylandloginmanager, by relying on udev's UACCESS attribute, 
instead of global ACLs

  Waylandloginmanager's loginmanagerdisplay weston instance, as well as all 
Zenity dialogs for the waylandloginmanager run as the daemom user, instead of 
root.

  Waylandloginmanager has been improved to support entering a custom user name, 
if it doesn't appear from the user list, the user list shows the real names, 
the control fifo is write only for a standard user, so that they can't read the 
FIFO before the loginmanger, and a seperate FIFO for registering session 
information is root only, so that it can't be filled with fake data.  

  Waylandloginmanager now handles the cancel button being pressed in the Zenity 
dialogs

  Waylandloginmanager now doesn't allow the user to flood with multiple 
login/info dialogs open at a time by mistake, or by a malicious program sending 
a command to the FIFO repeatedly to try to create a low memory condition.

  Waylandloginmanager now reads the loginmanager_control FIFO with a maximum 
read size, so that a local user can't cause it to eat memory and crash by 
filling it with /dev/zero, however under a unit test, I was able to crash a 
bash process reading a FIFO, by filling it up with /dev/random. I don't know 
how to reproduce it, but it could be a bug in bash, and I don't know if the 
bash process can be exploited with this bug.

  Waylandloginmanager now has a Weston independent dialog for user actions, 
without the mandatory launchers in the panel, (even though they are still 
currently configured).

  Usability fixes.

  Wayland/Weston 1.4+

  SWC

  More native KDE applications
  
  mutter-wayland has been built to a recent revision, GTK is backported to the 
3.11.0 tag for now (because later versions use XDG_Shell, which isn't yet 
supported by all sessions or servers.

  Contains the latest KDE Frameworks, which allows many KDE applications to run 
as native Wayland clients

-

***There is no password for the Live Session User (beccaholic), while autologin 
is enabled when starting as a live CD, if you get prompted for a password when 
starting a second login session, the password field is blank***
If you choose to install, the live session user does not get added, and instead 
the login becomes the default username and password that is configured at the 
installation wizard

In order for Enlightenment to start, you need to pass wlminputinsecure to the 
kernel command line. This argument is picked up by the Waylandloginmanager, and 
grant all plugdev (default) users permissions to the devices in /dev/input/* at 
all times. This allows local users to eavesdrop on these files, (which is the 
users input), but it's a temporary workar

Re: ANNOUNCE: New Wayland live CD

2014-03-21 Thread nerdopolis
On Friday, March 21, 2014 08:35:40 PM nerdopolis wrote:
> Hi.
> 
> 
> I am announcing new ISOs for my Wayland Live CD, which is named after my 
> favorite celebrity.
> 
> 
> You can find the new ISOs here:
> https://sourceforge.net/projects/rebeccablackos/files/2014-03-21/
> 
> Once again, the larger ISO is only larger because it has more development 
> headers, binaries with all the symbols, and more software installed to 
> compile and download source. The smaller ISO has no other reductions in the 
> user experience.
> 
> Also please note that all of my checkinstall built packages have the -rbos 
> suffix, and mostly reside in /opt. So Wayland master is provided by the 
> wayland-rbos package, NOT the libwayland package that comes from the system 
> repos for example. 
> 
> Except there are small changes that I made for backporting a few things for 
> the release
> DIFF of the changes to the SVN: http://pastebin.com/sDfA2izd
> 
> They currently contain:
>   * Wayland Master
>   * Weston Master 
>   * Wayland enabled Clutter
>   * Wayland enabled SDL
>   * Wayland enabled GTK
>   * Wayland enabled QT
>   * Wayland enabled EFL/Elementary
>   * Wayland enabled mplayer
>   * Wayland enabled gstreamer
>   * Orbital for Wayland (selectable at login) 
> https://github.com/giucam/orbital
>   * Hawaii for Wayland (selectable at login)   https://github.com/mauios
>   * KDE Frameworks Wayland programs 
>   * Native Calligra Wayland programs
>   * Wayland enabled Gnome-shell (selectable at login) *Does not work on 
> Virtualbox, except it can run nested
>   * A graphical utility for configuring udev for weston multiseat/multi 
> pointer
>   * A rudimentary but functional Wayland login manager written in Bash, that 
> supports user switching and session selection. 
>   * Wayland enabled Enlightenment E19 *Does not work on Virtualbox
>   *hardcoded screen size
>   * SWC tiling Wayland server (use super+enter for terminal, and super+r for 
> dmenu) *Does not work on Virtualbox, and does not run nested. Only tested on 
> Intel (selectable at login) https://github.com/michaelforney/swc
>   * Menu options to run Gnome Shell Wayland, Enlightenment e19 Wayland, 
> Orbital, SWC, and Hawaii desktops as nested sessions. 
> 
> -
>   More security on KMS supported cards, and will be more secure on FB, once 
> bug https://bugs.freedesktop.org/show_bug.cgi?id=73782 is fixed and I remove 
> the setfacls from waylandloginmanager, by relying on udev's UACCESS 
> attribute, instead of global ACLs
> 
>   Waylandloginmanager's loginmanagerdisplay weston instance, as well as all 
> Zenity dialogs for the waylandloginmanager run as the daemom user, instead of 
> root.
> 
>   Waylandloginmanager has been improved to support entering a custom user 
> name, if it doesn't appear from the user list, the user list shows the real 
> names, the control fifo is write only for a standard user, so that they can't 
> read the FIFO before the loginmanger, and a seperate FIFO for registering 
> session information is root only, so that it can't be filled with fake data.  
> 
>   Waylandloginmanager now handles the cancel button being pressed in the 
> Zenity dialogs
> 
>   Waylandloginmanager now doesn't allow the user to flood with multiple 
> login/info dialogs open at a time by mistake, or by a malicious program 
> sending a command to the FIFO repeatedly to try to create a low memory 
> condition.
> 
>   Waylandloginmanager now reads the loginmanager_control FIFO with a maximum 
> read size, so that a local user can't cause it to eat memory and crash by 
> filling it with /dev/zero, however under a unit test, I was able to crash a 
> bash process reading a FIFO, by filling it up with /dev/random. I don't know 
> how to reproduce it, but it could be a bug in bash, and I don't know if the 
> bash process can be exploited with this bug.
> 
>   Waylandloginmanager now has a Weston independent dialog for user actions, 
> without the mandatory launchers in the panel, (even though they are still 
> currently configured).
> 
>   Usability fixes.
> 
>   Wayland/Weston 1.4+
> 
>   SWC
> 
>   More native KDE applications
>   
>   mutter-wayland has been built to a recent revision, GTK is backported to 
> the 3.11.0 tag for now (because later versions use XDG_Shell, which isn't yet 
> supported by all sessions or servers.
> 
>   Contains the latest KDE Frameworks, which allows many KDE applications to 
> run as native Wayland clients
> 
> -
> 
> ***There is no password for the Live Session User (beccaholic), while 
> autologin is enabled when starting as a live CD, if y

Re: ANNOUNCE: New Wayland live CD

2014-03-23 Thread nerdopolis
On Sunday, March 23, 2014 04:49:50 PM Carlos Gomez, HCL America wrote:
> nerdopolis -
> 
> Thank you for doing all  this hard work.  I see that Qt 4.8.4 is installed.  
> I need Qt 5.x.  Is there another Wayland live CD with Qt 5.x that you know of?
> 
> Thank You,
> 
> Carlos
> 
> From: wayland-devel [wayland-devel-boun...@lists.freedesktop.org] On Behalf 
> Of nerdopolis [bluescreen_aven...@verizon.net]
> Sent: Friday, March 21, 2014 6:48 PM
> To: wayland-devel@lists.freedesktop.org
> Subject: Re: ANNOUNCE: New Wayland live CD
> 
> On Friday, March 21, 2014 08:35:40 PM nerdopolis wrote:
> > Hi.
> >
> >
> > I am announcing new ISOs for my Wayland Live CD, which is named after my 
> > favorite celebrity.
> >
> >
> > You can find the new ISOs here:
> > https://sourceforge.net/projects/rebeccablackos/files/2014-03-21/
> >
> > Once again, the larger ISO is only larger because it has more development 
> > headers, binaries with all the symbols, and more software installed to 
> > compile and download source. The smaller ISO has no other reductions in the 
> > user experience.
> >
> > Also please note that all of my checkinstall built packages have the -rbos 
> > suffix, and mostly reside in /opt. So Wayland master is provided by the 
> > wayland-rbos package, NOT the libwayland package that comes from the system 
> > repos for example.
> >
> > Except there are small changes that I made for backporting a few things for 
> > the release
> > DIFF of the changes to the SVN: http://pastebin.com/sDfA2izd
> >
> > They currently contain:
> >   * Wayland Master
> >   * Weston Master
> >   * Wayland enabled Clutter
> >   * Wayland enabled SDL
> >   * Wayland enabled GTK
> >   * Wayland enabled QT
> >   * Wayland enabled EFL/Elementary
> >   * Wayland enabled mplayer
> >   * Wayland enabled gstreamer
> >   * Orbital for Wayland (selectable at login) 
> > https://github.com/giucam/orbital
> >   * Hawaii for Wayland (selectable at login)   https://github.com/mauios
> >   * KDE Frameworks Wayland programs
> >   * Native Calligra Wayland programs
> >   * Wayland enabled Gnome-shell (selectable at login) *Does not work on 
> > Virtualbox, except it can run nested
> >   * A graphical utility for configuring udev for weston multiseat/multi 
> > pointer
> >   * A rudimentary but functional Wayland login manager written in Bash, 
> > that supports user switching and session selection.
> >   * Wayland enabled Enlightenment E19 *Does not work on Virtualbox
> >   *hardcoded screen size
> >   * SWC tiling Wayland server (use super+enter for terminal, and super+r 
> > for dmenu) *Does not work on Virtualbox, and does not run nested. Only 
> > tested on Intel (selectable at login) https://github.com/michaelforney/swc
> >   * Menu options to run Gnome Shell Wayland, Enlightenment e19 Wayland, 
> > Orbital, SWC, and Hawaii desktops as nested sessions.
> >
> > -
> >   More security on KMS supported cards, and will be more secure on FB, once 
> > bug https://bugs.freedesktop.org/show_bug.cgi?id=73782 is fixed and I 
> > remove the setfacls from waylandloginmanager, by relying on udev's UACCESS 
> > attribute, instead of global ACLs
> >
> >   Waylandloginmanager's loginmanagerdisplay weston instance, as well as all 
> > Zenity dialogs for the waylandloginmanager run as the daemom user, instead 
> > of root.
> >
> >   Waylandloginmanager has been improved to support entering a custom user 
> > name, if it doesn't appear from the user list, the user list shows the real 
> > names, the control fifo is write only for a standard user, so that they 
> > can't read the FIFO before the loginmanger, and a seperate FIFO for 
> > registering session information is root only, so that it can't be filled 
> > with fake data.
> >
> >   Waylandloginmanager now handles the cancel button being pressed in the 
> > Zenity dialogs
> >
> >   Waylandloginmanager now doesn't allow the user to flood with multiple 
> > login/info dialogs open at a time by mistake, or by a malicious program 
> > sending a command to the FIFO repeatedly to try to create a low memory 
> > condition.
> >
> >   Waylandloginmanager now reads the loginmanager_control FIFO with a 
> > maximum read size, so that a local user can't cause it to eat memory and 
> > crash by filling it with /dev/zero, however under a unit test, I was able 
> > to crash a bash process reading a FI

Re: ANNOUNCE: New Wayland live CD

2014-03-28 Thread nerdopolis
On Friday, March 28, 2014 12:30:17 PM Carlos Gomez, HCL America wrote:
> nerdopolis - 
> 
> Thanks for the correction on the QT5 installation.  I was able to run my 
> test.  I love what you did because I can do "compile tests" on the live 
> distro and compare RBOS behavior to my Wayland development target.  I am 
> using the vanilla Weston desktop you provided because that is what is 
> installed on our Wayland development target.
> 
> What hardware (CPU and GPU) are you using?  I want to know because I see a 
> lot of display issues (double cursor, repeating login prompts, cursor leaving 
> behind trails as if the background is not being restored) on the live distro 
> but I think that is my problem because of my choice of hardware (Dell laptops 
> of various vintage) and my lack of Wayland "configuration sophistication".  I 
> didn't build the Wayland/OS install I am testing, I am just using it.  I want 
> to give helpful feedback to the developer that is responsible for the Wayland 
> installation, and your distro is helping me to do that.
> 
> Carlos
> 
> From: wayland-devel [wayland-devel-boun...@lists.freedesktop.org] On Behalf 
> Of nerdopolis [bluescreen_aven...@verizon.net]
> Sent: Sunday, March 23, 2014 5:05 PM
> To: wayland-devel@lists.freedesktop.org
> Subject: Re: ANNOUNCE: New Wayland live CD
> 
> On Sunday, March 23, 2014 04:49:50 PM Carlos Gomez, HCL America wrote:
> > nerdopolis -
> >
> > Thank you for doing all  this hard work.  I see that Qt 4.8.4 is installed. 
> >  I need Qt 5.x.  Is there another Wayland live CD with Qt 5.x that you know 
> > of?
> >
> > Thank You,
> >
> > Carlos
> > 
> > From: wayland-devel [wayland-devel-boun...@lists.freedesktop.org] On Behalf 
> > Of nerdopolis [bluescreen_aven...@verizon.net]
> > Sent: Friday, March 21, 2014 6:48 PM
> > To: wayland-devel@lists.freedesktop.org
> > Subject: Re: ANNOUNCE: New Wayland live CD
> >
> > On Friday, March 21, 2014 08:35:40 PM nerdopolis wrote:
> > > Hi.
> > >
> > >
> > > I am announcing new ISOs for my Wayland Live CD, which is named after my 
> > > favorite celebrity.
> > >
> > >
> > > You can find the new ISOs here:
> > > https://sourceforge.net/projects/rebeccablackos/files/2014-03-21/
> > >
> > > Once again, the larger ISO is only larger because it has more development 
> > > headers, binaries with all the symbols, and more software installed to 
> > > compile and download source. The smaller ISO has no other reductions in 
> > > the user experience.
> > >
> > > Also please note that all of my checkinstall built packages have the 
> > > -rbos suffix, and mostly reside in /opt. So Wayland master is provided by 
> > > the wayland-rbos package, NOT the libwayland package that comes from the 
> > > system repos for example.
> > >
> > > Except there are small changes that I made for backporting a few things 
> > > for the release
> > > DIFF of the changes to the SVN: http://pastebin.com/sDfA2izd
> > >
> > > They currently contain:
> > >   * Wayland Master
> > >   * Weston Master
> > >   * Wayland enabled Clutter
> > >   * Wayland enabled SDL
> > >   * Wayland enabled GTK
> > >   * Wayland enabled QT
> > >   * Wayland enabled EFL/Elementary
> > >   * Wayland enabled mplayer
> > >   * Wayland enabled gstreamer
> > >   * Orbital for Wayland (selectable at login) 
> > > https://github.com/giucam/orbital
> > >   * Hawaii for Wayland (selectable at login)   https://github.com/mauios
> > >   * KDE Frameworks Wayland programs
> > >   * Native Calligra Wayland programs
> > >   * Wayland enabled Gnome-shell (selectable at login) *Does not work on 
> > > Virtualbox, except it can run nested
> > >   * A graphical utility for configuring udev for weston multiseat/multi 
> > > pointer
> > >   * A rudimentary but functional Wayland login manager written in Bash, 
> > > that supports user switching and session selection.
> > >   * Wayland enabled Enlightenment E19 *Does not work on Virtualbox
> > >   *hardcoded screen size
> > >   * SWC tiling Wayland server (use super+enter for terminal, and super+r 
> > > for dmenu) *Does not work on Virtualbox, and does not run nested. Only 
> > > tested on Intel (selectable at login) https://github.com/michaelforney/swc
> > >   * Menu options to run Gnome Shell Way

Wayland Live CD now switching to Mir

2014-04-01 Thread nerdopolis
Hi. 

As you all know, I have been the developer of the Wayland live CD for some 
time, which is named after my favorite celebrity, and has been providing a easy 
to obtain Wayland environment for users since 2012.
 
However I have been recently looking at the Wiki pages for Mir, and I am 
realizing that the Wiki pages have much nicer looking flowcharts then Wayland's 
wiki, and now I have decided to switch it over to Mir.

The ISOs announced last week are the last ISOs that will have Wayland on them

It's been a good run, but from now on I will be switching to all Mir related 
software. As there are currently no Mir ports for SWC, Enlightenment, Gnome 
Shell, Orbital, and Hawaii, Mplayer, and gstreamer, or GTK, they will be 
temporarily dropped.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[April Fools Joke] Re: Wayland Live CD now switching to Mir

2014-04-02 Thread nerdopolis
On Tuesday, April 01, 2014 10:20:43 AM Gustavo Noronha Silva wrote:
> On Tue, 2014-04-01 at 14:58 +0200, Kai-Uwe Behrmann wrote:
> > Am 01.04.2014 14:40, schrieb nerdopolis:
> > > As you all know, I have been the developer of the Wayland live CD for 
> > > some time, which is named after my favorite celebrity, and has been 
> > > providing a easy to obtain Wayland environment for users since 2012.
> > >  
> > > However I have been recently looking at the Wiki pages for Mir, and I am 
> > > realizing that the Wiki pages have much nicer looking flowcharts then 
> > > Wayland's wiki, and now I have decided to switch it over to Mir.
> > 
> > Which wiki do you mean?
> > 
> > wikipedia?:
> > https://en.wikipedia.org/wiki/Mir_%28display_server%29
> > https://en.wikipedia.org/wiki/Wayland_%28display_server_protocol%29
> 
> These, most likely:
> 
> http://wayland.freedesktop.org/architecture.html#heading_toc_j_0
> https://wiki.ubuntu.com/Mir/Spec#Mir_Today
> 
> 
Hi.

Just to confirm that this was an April Fools Joke, and my Wayland Live CD named 
after my favorite celebrity will continue being a Wayland Live CD, and is not 
switching to Mir.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 3/4] evdev: Fix assertion error for unplugged output with paired touchscreen

2014-04-25 Thread nerdopolis
On Thursday, April 24, 2014 03:11:16 PM Ander Conselvan de Oliveira wrote:
> From: Ander Conselvan de Oliveira 
> 
> If the output a touchscreen is paired to is unplugged, events coming
> from it should be ignored. Commit 17bccaed introduced logic for that
> in evdev_flush_pending_damage(). However, the break statements it
> introduced would cause the assertion after the switch statement to
> fail.
> 
> That function has the odd behavior that goto's are used to skip the
> assertion after the switch statement and jump to the hunk of code that
> marks the event as processed. Only in the case where the event type has
> an invalid value the assertion should trigger. So this patch fixes the
> problem by moving the assertion into the default case of the switch
> and replacing the goto statements with break ones.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=73950
> ---
>  src/evdev.c | 19 +--
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index 9d97c87..ff951d3 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -100,7 +100,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
> uint32_t time)
>   notify_motion(master, time, device->rel.dx, device->rel.dy);
>   device->rel.dx = 0;
>   device->rel.dy = 0;
> - goto handled;
> + break;
>   case EVDEV_ABSOLUTE_MT_DOWN:
>   if (device->output == NULL)
>   break;
> @@ -113,7 +113,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
> uint32_t time)
>   master->slot_map |= 1 << seat_slot;
>  
>   notify_touch(master, time, seat_slot, x, y, WL_TOUCH_DOWN);
> - goto handled;
> + break;
>   case EVDEV_ABSOLUTE_MT_MOTION:
>   if (device->output == NULL)
>   break;
> @@ -123,12 +123,12 @@ evdev_flush_pending_event(struct evdev_device *device, 
> uint32_t time)
>  &x, &y);
>   seat_slot = device->mt.slots[slot].seat_slot;
>   notify_touch(master, time, seat_slot, x, y, WL_TOUCH_MOTION);
> - goto handled;
> + break;
>   case EVDEV_ABSOLUTE_MT_UP:
>   seat_slot = device->mt.slots[slot].seat_slot;
>   master->slot_map &= ~(1 << seat_slot);
>   notify_touch(master, time, seat_slot, 0, 0, WL_TOUCH_UP);
> - goto handled;
> + break;
>   case EVDEV_ABSOLUTE_TOUCH_DOWN:
>   if (device->output == NULL)
>   break;
> @@ -141,7 +141,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
> uint32_t time)
>   device->abs.seat_slot = seat_slot;
>   master->slot_map |= 1 << seat_slot;
>   notify_touch(master, time, seat_slot, x, y, WL_TOUCH_DOWN);
> - goto handled;
> + break;
>   case EVDEV_ABSOLUTE_MOTION:
>   if (device->output == NULL)
>   break;
> @@ -156,17 +156,16 @@ evdev_flush_pending_event(struct evdev_device *device, 
> uint32_t time)
>x, y, WL_TOUCH_MOTION);
>   else if (device->seat_caps & EVDEV_SEAT_POINTER)
>   notify_motion_absolute(master, time, x, y);
> - goto handled;
> + break;
>   case EVDEV_ABSOLUTE_TOUCH_UP:
>   seat_slot = device->abs.seat_slot;
>   master->slot_map &= ~(1 << seat_slot);
>   notify_touch(master, time, seat_slot, 0, 0, WL_TOUCH_UP);
> - goto handled;
> + break;
> + default:
> + assert(0 && "Unknown pending event type");
>   }
>  
> - assert(0 && "Unknown pending event type");
> -
> -handled:
>   device->pending_event = EVDEV_NONE;
>  }
>  
> 
These patches fixed the libinput crashing for me as well. 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


  1   2   >