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


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: 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


[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

[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 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 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 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 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 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 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 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 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 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


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


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 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-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


[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


[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 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 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 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

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 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


[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 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 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 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 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 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 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


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


[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


[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 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 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 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 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 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 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 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


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


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 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 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


[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


[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 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 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 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 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 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 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 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 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] 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] 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 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 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


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


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: 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


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: [ANNOUNCE] Wayland Live CD release

2016-10-18 Thread nerdopolis
What kind of video card hardware do you have? (intel/nvidia/amd), or are you 
using a VM?
Did you try with a framebuffer option?
What part does it actually hang at?

On Tuesday, October 18, 2016 11:37:29 AM EDT you wrote:
> Bug don't response
> 
> DanielTorres
> On Oct 16, 2016 12:18 AM, "nerdopolis" 
> wrote:
> 
> > Hi.
> >
> > I have pushed out new ISO files for the Wayland Live CD project, named
> > after my favorite celebrity (Rebecca Black).
> > I wanted to time the release to celebrate the release of her new
> > song The Great Divide, but I had some issues I previously had to resolve
> >
> > This might be the last set of ISOs I announce here. I will post newer
> > ISOs/commits, but probably won't announce to the Wayland mailing list.
> >
> > I have almost everything Wayland related on these ISOs, and also now,
> > there are an increasing number distributions containing Wayland sessions,
> > such as Fedora with Gnome-Shell, and KDE Neon's ISOs.
> >
> >
> > My ISOs have more Wayland Desktops however, both KDE and Gnome, as well as
> > Enlightenment, Orbital, Hawaii, Orbment and Sway.
> > Also all Wayland enabled toolkits, Qt, GTK, EFL, SDL, glfw and FreeGLUT
> > This has the master versions of all the Desktop Environments.
> >
> > They also still include the wizard utility for easily configuring weston
> > mulitseat/multipointer, instead of manually editing udev
> > It can be run from the menu, or
> > wlsudo configureseats
> >
> >
> > Releases are on Sourceforge and Github
> > https://sourceforge.net/projects/rebeccablackos/files/2016-10-09/
> > https://github.com/n3rdopolis/rebeccablackos/releases/tag/2016-10-09
> >
> >
> > The ISOs remain based on Debian Testing.
> >
> > New in this release: Most of the changes is within the upstream releases.
> > Within the SVN, The build scripts, and the iso test script now mounts all
> > bind mounts and union mounts in a separate namespace, the
> > waylandloginmanager now shows descriptions for each desktop environment,
> > (mainly to tell users how to use Sway and Orbment), and on the smaller
> > ISOs, a second checkinstall operation handles the removal of the headers,
> > and removal of symbols from the binaries, to minimize the number of files
> > changed, to reduce the number of errors reported by dpkg checksum
> > validation, and the ISOs were built with SVN commit 4377 .
> > ___
> > wayland-devel mailing list
> > wayland-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >
> 


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


[ANNOUNCE] Wayland Live CD release

2016-10-15 Thread nerdopolis
Hi.

I have pushed out new ISO files for the Wayland Live CD project, named after my 
favorite celebrity (Rebecca Black).
I wanted to time the release to celebrate the release of her new song 
The Great Divide, but I had some issues I previously had to resolve

This might be the last set of ISOs I announce here. I will post newer 
ISOs/commits, but probably won't announce to the Wayland mailing list.

I have almost everything Wayland related on these ISOs, and also now, there are 
an increasing number distributions containing Wayland sessions, such as Fedora 
with Gnome-Shell, and KDE Neon's ISOs.


My ISOs have more Wayland Desktops however, both KDE and Gnome, as well as 
Enlightenment, Orbital, Hawaii, Orbment and Sway.
Also all Wayland enabled toolkits, Qt, GTK, EFL, SDL, glfw and FreeGLUT
This has the master versions of all the Desktop Environments. 

They also still include the wizard utility for easily configuring weston 
mulitseat/multipointer, instead of manually editing udev
It can be run from the menu, or
wlsudo configureseats


Releases are on Sourceforge and Github
https://sourceforge.net/projects/rebeccablackos/files/2016-10-09/
https://github.com/n3rdopolis/rebeccablackos/releases/tag/2016-10-09


The ISOs remain based on Debian Testing.

New in this release: Most of the changes is within the upstream releases. 
Within the SVN, The build scripts, and the iso test script now mounts all bind 
mounts and union mounts in a separate namespace, the waylandloginmanager now 
shows descriptions for each desktop environment, (mainly to tell users how to 
use Sway and Orbment), and on the smaller ISOs, a second checkinstall operation 
handles the removal of the headers, and removal of symbols from the binaries, 
to minimize the number of files changed, to reduce the number of errors 
reported by dpkg checksum validation, and the ISOs were built with SVN commit 
4377 .
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] libweston-desktop: fix stale ping when a wl_shell_surface is destroyed

2016-09-27 Thread nerdopolis
Hi

Is this patch for https://bugs.freedesktop.org/show_bug.cgi?id=97892 , or is it 
for a different issue that I am getting confused with?
It doesn't seem to fix the issue with wl_shell for qtwayland and EFL (when EFL 
is forced to use wl_shell)

It actually seems to make the issue affect all surfaces instead of just the 
first one.

Unless if this patch is for a similar sounding, but different issue?

Thanks
On Monday, September 26, 2016 12:37:54 PM EDT Giulio Camuffo wrote:
> When sending a ping event to a surface using the wl_shell interface,
> if that surface is destroyed before we receive the pong we will never
> receive it, even if the client is actually responsive, since the
> interface does not exist anymore. So when the surface if destroyed
> pretend it's a pong and reset the ping state.
> ---
> 
> v2: put the logic in the wl_shell specific file instead of the common code
> 
>  libweston-desktop/client.c   | 10 +-
>  libweston-desktop/internal.h |  4 +++-
>  libweston-desktop/wl-shell.c | 42 
> ++--
>  libweston-desktop/xdg-shell-v5.c |  2 +-
>  libweston-desktop/xdg-shell-v6.c |  2 +-
>  libweston-desktop/xwayland.c |  3 ++-
>  6 files changed, 56 insertions(+), 7 deletions(-)
> 
> diff --git a/libweston-desktop/client.c b/libweston-desktop/client.c
> index 29c3c98..810b6ba 100644
> --- a/libweston-desktop/client.c
> +++ b/libweston-desktop/client.c
> @@ -39,6 +39,7 @@ struct weston_desktop_client {
>   uint32_t ping_serial;
>   struct wl_event_source *ping_timer;
>   struct wl_signal destroy_signal;
> + void *user_data;
>  };
>  
>  void
> @@ -86,7 +87,7 @@ weston_desktop_client_create(struct weston_desktop *desktop,
>wl_dispatcher_func_t dispatcher,
>const struct wl_interface *interface,
>const void *implementation, uint32_t version,
> -  uint32_t id)
> +  uint32_t id, void *user_data)
>  {
>   struct weston_desktop_client *client;
>   struct wl_display *display;
> @@ -101,6 +102,7 @@ weston_desktop_client_create(struct weston_desktop 
> *desktop,
>  
>   client->desktop = desktop;
>   client->client = wl_client;
> + client->user_data = user_data;
>  
>   wl_list_init(&client->surface_list);
>   wl_signal_init(&client->destroy_signal);
> @@ -210,3 +212,9 @@ weston_desktop_client_pong(struct weston_desktop_client 
> *client, uint32_t serial
>   wl_event_source_timer_update(client->ping_timer, 0);
>   client->ping_serial = 0;
>  }
> +
> +void *
> +weston_desktop_client_get_user_data(struct weston_desktop_client *client)
> +{
> + return client->user_data;
> +}
> diff --git a/libweston-desktop/internal.h b/libweston-desktop/internal.h
> index a9c974b..6f8b5aa 100644
> --- a/libweston-desktop/internal.h
> +++ b/libweston-desktop/internal.h
> @@ -128,7 +128,7 @@ weston_desktop_client_create(struct weston_desktop 
> *desktop,
>wl_dispatcher_func_t dispatcher,
>const struct wl_interface *interface,
>const void *implementation, uint32_t version,
> -  uint32_t id);
> +  uint32_t id, void *user_data);
>  
>  void
>  weston_desktop_client_add_destroy_listener(struct weston_desktop_client 
> *client,
> @@ -143,6 +143,8 @@ weston_desktop_client_get_surface_list(struct 
> weston_desktop_client *client);
>  void
>  weston_desktop_client_pong(struct weston_desktop_client *client,
>  uint32_t serial);
> +void *
> +weston_desktop_client_get_user_data(struct weston_desktop_client *client);
>  
>  struct weston_desktop_surface *
>  weston_desktop_surface_create(struct weston_desktop *desktop,
> diff --git a/libweston-desktop/wl-shell.c b/libweston-desktop/wl-shell.c
> index ded69f7..3a81f42 100644
> --- a/libweston-desktop/wl-shell.c
> +++ b/libweston-desktop/wl-shell.c
> @@ -58,6 +58,11 @@ struct weston_desktop_wl_shell_surface {
>   enum weston_desktop_wl_shell_surface_state state;
>  };
>  
> +struct wl_shell_client {
> + struct weston_desktop_wl_shell_surface *ping_surface;
> + uint32_t ping_serial;
> +};
> +
>  static void
>  weston_desktop_wl_shell_surface_set_size(struct weston_desktop_surface 
> *dsurface,
>void *user_data,
> @@ -109,7 +114,12 @@ weston_desktop_wl_shell_surface_ping(struct 
> weston_desktop_surface *dsurface,
>uint32_t serial, void *user_data)
>  {
>   struct weston_desktop_wl_shell_surface *surface = user_data;
> + struct weston_desktop_client *client =
> + weston_desktop_surface_get_client(dsurface);
> + struct wl_shell_client *wsc = 
> weston_desktop_client_get_user_data(client);
>  
> + wsc->ping_surface = surface;
> + wsc->ping_serial = serial;
>   wl_shell_surface_s

[ANNOUNCE] Wayland Live CD release

2015-06-06 Thread nerdopolis
Hi.

I have pushed out new ISO files for the Wayland Live CD project, named after my 
favorite celebrity (Rebecca Black).

These have Wayland an Weston master, which when built, were a few commits ahead 
of the 1.8 releases of Wayland and Weston.

Notably:
The bash waylandloginmanager no longer uses weston-launch to start Wayland 
sessions for the user. Instead runuser is used to call up the sessions.
This enhances security, as weston-launch's FD's are no longer being 
leaked to non weston sessions.
Permissions to /dev/fb0 are no longer granted to all users of the plugdev 
group. Instead the UACCESS permission on the framebuffer devices is configured
This enhances security for potential multiuser systems with no KMS 
drivers, won't be able to read the framebuffer when their session is not in the 
active VT.
Calligra applications are back, as they build against QT 5, from the WIP 
frameworks branch
FreeGLUT and GLFW are compiled to use the Wayland backend, and installed into 
/opt along with the other Wayland toolkits
FreeGLUT and GLFW appear to only support one compiled in backend.
SWC has been replaced with Orbment
Ubuntu Vivid is the base, which has a new enough version of logind by default, 
which means that the number of first tier files that gets clobbered by the 
second tier compiled packages dropped quite a bit, as no longer need to compile 
my own systemd, or include dozens of modified systemd unit files from a Fedora 
Live CD in the SVN.
The only files that get overwritten by compiled packages are in /etc/ 
and /usr/include . Some files leak out of the selected prefix of /opt in a few 
packages...

The KDE session that is selectable, but it is currently too early to be 
usable.KDE _applications_ work, and plasmashell even runs in Weston, 
although most of the shell features such as window list and desktop selections 
do NOT, along with the placement of the panels, and desktop window are 
haphazard. Just not kwin_wayland yet...


Releases are on Sourceforge, and I'm also trying a github mirror.Only the ISOs 
with out the development headers, and debug symbols can fit in GitHub
https://sourceforge.net/projects/rebeccablackos/files/2015-06-05/
https://github.com/n3rdopolis/rebeccablackos/releases/tag/2015-06-05


Release notes: (Sorry about the length)
---
These ISOs are RELEASE. Using SVN Revision 3615,

They currently contain:
Wayland Libraries:
  * Wayland Master
  * Weston Master 
Wayland Toolkits and Applications:
  * Wayland enabled Clutter
  * Wayland enabled SDL
  * Wayland enabled GTK
  * Wayland enabled QT
  * Wayland enabled EFL/Elementary
  * Wayland enabled FreeGLUT
  * Wayland enabled GLFW
  * Wayland enabled mpv
  * Wayland enabled gstreamer
  * KDE Frameworks Wayland programs 
  * Native Calligra Wayland programs
Wayland Desktops:
  * Weston's Example Desktop (selectable at login, and as a nested session from 
the application menu)
  * Orbital (selectable at login, and as a nested session from the application 
menu) (NOT on this ISO)
  * Hawaii (selectable at login, and as a nested session from the application 
menu)
  * Papyros (selectable at login, and as a nested session from the application 
menu) (Only works from nested currently)
  * Gnome-shell (selectable at login, and as a nested session from the 
application menu) 
  **Does not work on Virtualbox, except it can run nested
  * Enlightenment E19 (selectable at login, and as a nested session from the 
application menu)
  **Does not work on Virtualbox, except it can run nested
  * Orbment tiling Wayland DE *Does not work on Virtualbox (selectable at 
login, and as a nested session from the application menu)
   **Use super+enter for terminal, and super+r for dmenu
Other Features:
  * 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. 
  * RDP enabled Weston

New in these ISOs:-

The WaylandLoginManager no longer uses weston-launch to call Wayland session, 
and instead uses runuser. This requires logind v216 due to bugfixes. This is 
for better security, as non-weston sessions would not hang up the file 
descriptors that weston-launch opens.

Global permissions to the plugdev group are no longer granted to framebuffer 
devices. Now they are granted by udev, by setting the UACCESS attribute, and 
applying a workaround in Weston.

Wayland Login Manager supports starting with an option to disable vblank, as 
vblank causes some problems in some hardware platforms

Except for the setting the proper variables for a user session (with 
/usr/bin/wlruntime_vars), and config file for the login manager display, and 
configuring runuser to use systemd with the PAM configuration files, all of the 
functionality of the WaylandLoginManager is now in /usr/bin/waylandloginmanager

Systemd is now provided upstream 

[PATCH] desktop-shell: provide an option, background-bpp , for specifing the bit depth of the wallpaper

2015-05-25 Thread nerdopolis
---
 clients/desktop-shell.c   | 13 +++--
 man/weston.ini.man|  5 +
 tests/internal-screenshot.ini |  1 +
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 777a50a..d620daf 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -94,6 +94,7 @@ struct background {
char *image;
int type;
uint32_t color;
+   uint32_t bpp;
 };
 
 struct output {
@@ -1015,10 +1016,18 @@ background_create(struct desktop *desktop)
window_set_user_data(background->window, background);
widget_set_redraw_handler(background->widget, background_draw);
widget_set_transparent(background->widget, 0);
-   window_set_preferred_format(background->window,
-   WINDOW_PREFERRED_FORMAT_RGB565);
 
s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
+   weston_config_section_get_uint(s, "background-bpp",
+&background->bpp, 16);
+   /* TODO After Weston 1.8, change default to 32 bit bpp on the 
wallpaper*/
+   if (background->low_bpp != 32) {
+ window_set_preferred_format(background->window,
+ WINDOW_PREFERRED_FORMAT_RGB565);
+   } elseif (background->low_bpp != 16 && background->low_bpp != 32 ) {
+ weston_log("invalid background bpp specified in ini file\n");
+   }
+
weston_config_section_get_string(s, "background-image",
 &background->image, NULL);
weston_config_section_get_uint(s, "background-color",
diff --git a/man/weston.ini.man b/man/weston.ini.man
index fe86bb6..2f60c15 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -216,6 +216,11 @@ output. Tile repeats the background image to fill the 
output.
 sets the color of the background (unsigned integer). The hexadecimal
 digit pairs are in order alpha, red, green, and blue.
 .TP 7
+.BI "background-bpp=" true
+specify to set the background to 16 bit or 32 color (unsigned integer).
+Setting this option to 16 bit color is useful for low memory platforms,
+such as embedded devices. This only affects the background.
+.TP 7
 .BI "panel-color=" 0xAARRGGBB
 sets the color of the panel (unsigned integer). The hexadecimal
 digit pairs are in order transparency, red, green, and blue. Examples:
diff --git a/tests/internal-screenshot.ini b/tests/internal-screenshot.ini
index abc046e..be68345 100644
--- a/tests/internal-screenshot.ini
+++ b/tests/internal-screenshot.ini
@@ -1,3 +1,4 @@
 [shell]
 startup-animation=none
 background-color=0xCC336699
+background-bpp=16
-- 
2.1.0

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


Re: [PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

2015-05-23 Thread nerdopolis
On Friday, May 22, 2015 01:19:58 AM you wrote:
> On Thu, May 21, 2015 at 11:15:54PM -0400, nerdopolis wrote:
> > On Thursday, May 21, 2015 05:23:30 PM you wrote:
> > > On Thu, May 21, 2015 at 04:35:16PM -0400, nerdopolis wrote:
> > > > ---
> > > >  clients/desktop-shell.c | 10 --
> > > >  man/weston.ini.man  |  4 
> > > >  2 files changed, 12 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
> > > > index e2f9f80..cc4a502 100644
> > > > --- a/clients/desktop-shell.c
> > > > +++ b/clients/desktop-shell.c
> > > > @@ -94,6 +94,7 @@ struct background {
> > > > char *image;
> > > > int type;
> > > > uint32_t color;
> > > > +   int32_t low_bpp;
> > > >  };
> > > 
> > > I agree with Bill and pq that this name needs to be thought out better.
> > > 'low' is a relative term.  32 bpp is low compared with 64, and 16 bpp is
> > > high compared with 8.
> > > 
> > > Internally I suggest this just be 'bpp', with values 16 or 32.
> > > Externally, you could still use boolean options for selecting it, if you
> > > really must.
> > > 
> > OK I'll do background_bpp
> > > >  struct output {
> > > > @@ -1015,10 +1016,15 @@ background_create(struct desktop *desktop)
> > > > window_set_user_data(background->window, background);
> > > > widget_set_redraw_handler(background->widget, background_draw);
> > > > widget_set_transparent(background->widget, 0);
> > > > -   window_set_preferred_format(background->window,
> > > > -   WINDOW_PREFERRED_FORMAT_RGB565);
> > > >  
> > > > s = weston_config_get_section(desktop->config, "shell", NULL, 
> > > > NULL);
> > > > +   weston_config_section_get_bool(s, "background-low-bpp",
> > > > +&background->low_bpp, NULL);
> > > 
> > > The last parameter must be an int.  NULL is a void*.  This causes a
> > > build warning:
> > OK. I'll fix this...
> > > 
> > >   CC   clients/weston_desktop_shell-desktop-shell.o
> > > clients/desktop-shell.c: In function ‘background_create’:
> > > clients/desktop-shell.c:1022:7: warning: passing argument 4 of 
> > > ‘weston_config_section_get_bool’ makes integer from pointer without a 
> > > cast [enabled by default]
> > >&background->low_bpp, NULL);
> > >^
> > > In file included from clients/window.h:31:0,
> > >  from clients/desktop-shell.c:44:
> > > clients/../shared/config-parser.h:94:1: note: expected ‘int’ but argument 
> > > is of type ‘void *’
> > >  weston_config_section_get_bool(struct weston_config_section *section,
> > >  ^
> > >   CCLD weston-desktop-shell
> > > 
> > > So I think what you want is:
> > > 
> > >   weston_config_section_get_bool(s, "background-low-bpp",
> > >&background->low_bpp, 0);
> > > 
> > > But, I think the option needs a bit more thinking...
> > > 
> > > Options as --background-16-bpp and --background-32-bpp might be clearer.
> > > Makes also feasible adding other bpp's later.
> > > 
> > > But what happens if you set both to true?  Or both false?
> > > 
> > > So, I agree with Bill that a --background-bpp=[32|16] is the most
> > > sensible, with documentation specifying the legal values, and input
> > > checks that error if something other than 16 or 32 is specified.
> > > 
> > So if the background-bpp=16, I set the wallpaper to RGB565, if it's 32 I do 
> > nothing, and anything else, 
> > I weston_log that it's an invalid value?
> > 
> > but should 16bpp for the wallpaper be the default, if it's not specified or 
> > set to 29 or something? or 32 bit?
> > I feel like 16bpp really only benefits users on extremely limited memory 
> > platforms, and most users would want 
> > it in 32bpp, but I can change it if it breaks tests...
> 
> In that case, it's fine but you'll need to update the test reference
> image.  This is easy, just copy the ./internal-screenshot-00.png to
> tests/reference/internal-scre

Re: [PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

2015-05-21 Thread nerdopolis
On Thursday, May 21, 2015 05:23:30 PM you wrote:
> On Thu, May 21, 2015 at 04:35:16PM -0400, nerdopolis wrote:
> > ---
> >  clients/desktop-shell.c | 10 --
> >  man/weston.ini.man  |  4 
> >  2 files changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
> > index e2f9f80..cc4a502 100644
> > --- a/clients/desktop-shell.c
> > +++ b/clients/desktop-shell.c
> > @@ -94,6 +94,7 @@ struct background {
> > char *image;
> > int type;
> > uint32_t color;
> > +   int32_t low_bpp;
> >  };
> 
> I agree with Bill and pq that this name needs to be thought out better.
> 'low' is a relative term.  32 bpp is low compared with 64, and 16 bpp is
> high compared with 8.
> 
> Internally I suggest this just be 'bpp', with values 16 or 32.
> Externally, you could still use boolean options for selecting it, if you
> really must.
> 
OK I'll do background_bpp
> >  struct output {
> > @@ -1015,10 +1016,15 @@ background_create(struct desktop *desktop)
> > window_set_user_data(background->window, background);
> > widget_set_redraw_handler(background->widget, background_draw);
> > widget_set_transparent(background->widget, 0);
> > -   window_set_preferred_format(background->window,
> > -   WINDOW_PREFERRED_FORMAT_RGB565);
> >  
> > s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
> > +   weston_config_section_get_bool(s, "background-low-bpp",
> > +&background->low_bpp, NULL);
> 
> The last parameter must be an int.  NULL is a void*.  This causes a
> build warning:
OK. I'll fix this...
> 
>   CC   clients/weston_desktop_shell-desktop-shell.o
> clients/desktop-shell.c: In function ‘background_create’:
> clients/desktop-shell.c:1022:7: warning: passing argument 4 of 
> ‘weston_config_section_get_bool’ makes integer from pointer without a cast 
> [enabled by default]
>&background->low_bpp, NULL);
>^
> In file included from clients/window.h:31:0,
>  from clients/desktop-shell.c:44:
> clients/../shared/config-parser.h:94:1: note: expected ‘int’ but argument is 
> of type ‘void *’
>  weston_config_section_get_bool(struct weston_config_section *section,
>  ^
>   CCLD weston-desktop-shell
> 
> So I think what you want is:
> 
>   weston_config_section_get_bool(s, "background-low-bpp",
>&background->low_bpp, 0);
> 
> But, I think the option needs a bit more thinking...
> 
> Options as --background-16-bpp and --background-32-bpp might be clearer.
> Makes also feasible adding other bpp's later.
> 
> But what happens if you set both to true?  Or both false?
> 
> So, I agree with Bill that a --background-bpp=[32|16] is the most
> sensible, with documentation specifying the legal values, and input
> checks that error if something other than 16 or 32 is specified.
> 
So if the background-bpp=16, I set the wallpaper to RGB565, if it's 32 I do 
nothing, and anything else, 
I weston_log that it's an invalid value?

but should 16bpp for the wallpaper be the default, if it's not specified or set 
to 29 or something? or 32 bit?
I feel like 16bpp really only benefits users on extremely limited memory 
platforms, and most users would want 
it in 32bpp, but I can change it if it breaks tests...
> > +   if (background->low_bpp) {
> > + window_set_preferred_format(background->window,
> > + WINDOW_PREFERRED_FORMAT_RGB565);
> > +   }
> 
> This changes the default behavior of weston.  Before, it was setting
> this format as the default, now it sets it only when the low bpp option
> is given.
> 
> In fact, this breaks the internal-screenshot test case.
> 
> > weston_config_section_get_string(s, "background-image",
> >  &background->image, NULL);
> > weston_config_section_get_uint(s, "background-color",
> > diff --git a/man/weston.ini.man b/man/weston.ini.man
> > index fe86bb6..3a8b2a4 100644
> > --- a/man/weston.ini.man
> > +++ b/man/weston.ini.man
> > @@ -216,6 +216,10 @@ output. Tile repeats the background image to fill the 
> > output.
> >  sets the color of the background (unsigned integer). The hexadecimal
> >  digit pairs are in order alpha, red, green, and blue.
> >  .TP 7
> > +.BI "background-low-bpp=" true
> > +specify to reduce the backgro

[PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

2015-05-21 Thread nerdopolis
---
 clients/desktop-shell.c | 10 --
 man/weston.ini.man  |  4 
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index e2f9f80..cc4a502 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -94,6 +94,7 @@ struct background {
char *image;
int type;
uint32_t color;
+   int32_t low_bpp;
 };
 
 struct output {
@@ -1015,10 +1016,15 @@ background_create(struct desktop *desktop)
window_set_user_data(background->window, background);
widget_set_redraw_handler(background->widget, background_draw);
widget_set_transparent(background->widget, 0);
-   window_set_preferred_format(background->window,
-   WINDOW_PREFERRED_FORMAT_RGB565);
 
s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
+   weston_config_section_get_bool(s, "background-low-bpp",
+&background->low_bpp, NULL);
+   if (background->low_bpp) {
+ window_set_preferred_format(background->window,
+ WINDOW_PREFERRED_FORMAT_RGB565);
+   }
+
weston_config_section_get_string(s, "background-image",
 &background->image, NULL);
weston_config_section_get_uint(s, "background-color",
diff --git a/man/weston.ini.man b/man/weston.ini.man
index fe86bb6..3a8b2a4 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -216,6 +216,10 @@ output. Tile repeats the background image to fill the 
output.
 sets the color of the background (unsigned integer). The hexadecimal
 digit pairs are in order alpha, red, green, and blue.
 .TP 7
+.BI "background-low-bpp=" true
+specify to reduce the background to 16 bit color (boolean). This option is
+useful for low memory platforms. This only affects the background.
+.TP 7
 .BI "panel-color=" 0xAARRGGBB
 sets the color of the panel (unsigned integer). The hexadecimal
 digit pairs are in order transparency, red, green, and blue. Examples:
-- 
2.1.0

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


[PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

2015-05-20 Thread nerdopolis
---
 clients/desktop-shell.c | 13 +++--
 man/weston.ini.man  |  4 
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index e2f9f80..d4ba127 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -94,6 +94,7 @@ struct background {
char *image;
int type;
uint32_t color;
+   int32_t low_bpp;
 };
 
 struct output {
@@ -1015,10 +1016,18 @@ background_create(struct desktop *desktop)
window_set_user_data(background->window, background);
widget_set_redraw_handler(background->widget, background_draw);
widget_set_transparent(background->widget, 0);
-   window_set_preferred_format(background->window,
-   WINDOW_PREFERRED_FORMAT_RGB565);
 
s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
+   weston_config_section_get_bool(s, "background-low-bpp",
+&background->low_bpp, NULL);
+   if (!background->low_bpp) {
+ window_set_preferred_format(background->window,
+ WINDOW_PREFERRED_FORMAT_NONE);
+   } else {
+ window_set_preferred_format(background->window,
+ WINDOW_PREFERRED_FORMAT_RGB565);
+   }
+
weston_config_section_get_string(s, "background-image",
 &background->image, NULL);
weston_config_section_get_uint(s, "background-color",
diff --git a/man/weston.ini.man b/man/weston.ini.man
index fe86bb6..3a8b2a4 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -216,6 +216,10 @@ output. Tile repeats the background image to fill the 
output.
 sets the color of the background (unsigned integer). The hexadecimal
 digit pairs are in order alpha, red, green, and blue.
 .TP 7
+.BI "background-low-bpp=" true
+specify to reduce the background to 16 bit color (boolean). This option is
+useful for low memory platforms. This only affects the background.
+.TP 7
 .BI "panel-color=" 0xAARRGGBB
 sets the color of the panel (unsigned integer). The hexadecimal
 digit pairs are in order transparency, red, green, and blue. Examples:
-- 
2.1.0

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


Re: [PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

2015-05-20 Thread nerdopolis
On Wednesday, May 20, 2015 12:17:42 PM Bill Spitzak wrote:
> That name is pretty confusing and not what anybody would guess. It 
> certainly should start with "background-" so that it matches all the 
> other switches that control the desktop image.
> 
> The fact that it does not always work does NOT have to be part of the name.
> 
> Some ideas I prefer:
> 
> background-depth=16
> background-format=RGB565
> 
> The fact that it takes a number or name does not mean you have to worry 
> about any values other than the one you are interested in. In particular 
> if a depth is used just use 'background_depth <= 16' to choose whether 
> to try RGB565. If a format name is used I think you can insist the only 
> ones that do not produce an error are "RGB565" and "". Future versions 
> can then enhance this with obvious additions, rather than being forced 
> to add even more switches.
> 
> I am also annoyed that the keywords have dashes in them (thus requiring 
> the C variable that stores the value to have a different name) but that 
> seems to be well-established here...
> 
> On 05/20/2015 04:55 AM, nerdopolis wrote:
> 
> > s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
> > +   weston_config_section_get_bool(s, "background-low-bitrate",
> > +&background->low_bitrate, NULL);
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Hi.

I submitted a patch changing it to background-low-bpp

While the option might be slighty harder to guess, I think a boolean is better.
Specifying the format will cause users to look up the names of 
the formats. 
I don't know how many people would remember RGB565 

Doing an integer for number of pixels might lead to attempts to 
set it at
4, or 8, when it only supports 16 or 32 bit... 

It is unlikely that more bpp options will be used for just the weston 
background... 
It was only at low bpp to reduce memory usage on the Raspberry Pi...
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

2015-05-20 Thread nerdopolis
---
 clients/desktop-shell.c | 13 +++--
 man/weston.ini.man  |  4 
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index e2f9f80..970b9f0 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -94,6 +94,7 @@ struct background {
char *image;
int type;
uint32_t color;
+   int32_t low_bitrate;
 };
 
 struct output {
@@ -1015,10 +1016,18 @@ background_create(struct desktop *desktop)
window_set_user_data(background->window, background);
widget_set_redraw_handler(background->widget, background_draw);
widget_set_transparent(background->widget, 0);
-   window_set_preferred_format(background->window,
-   WINDOW_PREFERRED_FORMAT_RGB565);
 
s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
+   weston_config_section_get_bool(s, "background-low-bitrate",
+&background->low_bitrate, NULL);
+   if (!background->low_bitrate) {
+ window_set_preferred_format(background->window,
+ WINDOW_PREFERRED_FORMAT_NONE);
+   } else {
+ window_set_preferred_format(background->window,
+ WINDOW_PREFERRED_FORMAT_RGB565);
+   }
+
weston_config_section_get_string(s, "background-image",
 &background->image, NULL);
weston_config_section_get_uint(s, "background-color",
diff --git a/man/weston.ini.man b/man/weston.ini.man
index fe86bb6..240fbd8 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -216,6 +216,10 @@ output. Tile repeats the background image to fill the 
output.
 sets the color of the background (unsigned integer). The hexadecimal
 digit pairs are in order alpha, red, green, and blue.
 .TP 7
+.BI "background-low-bitrate=" true
+specify to reduce the background to 16 bit color (boolean). This option is
+useful for low memory platforms.
+.TP 7
 .BI "panel-color=" 0xAARRGGBB
 sets the color of the panel (unsigned integer). The hexadecimal
 digit pairs are in order transparency, red, green, and blue. Examples:
-- 
2.1.0

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


[PATCH] drm-backend: for now, on the egl backend, force gl cursors to be used instead of hardware cursors

2015-05-18 Thread nerdopolis
Hardware cursors have been causing some problems with some drivers, mostly i915

This will probably be changed once Atomic Mode Setting arrives, to probably 
only force gl cursors
to always be on when Atomic Mode Setting isn't supported by the driver, or 
kernel version
---
 src/compositor-drm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 0cdb8f4..0636a37 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1641,6 +1641,9 @@ drm_output_init_egl(struct drm_output *output, struct 
drm_compositor *ec)
weston_log("cursor buffers unavailable, using gl cursors\n");
ec->cursors_are_broken = 1;
}
+   /* TODO Remove when atomic mode setting is merged into the mainline 
kernel, and detect if the
+* running kernel supports atomic mode setting instead. */
+   ec->cursors_are_broken = 1;
 
return 0;
 }
-- 
2.1.0

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


  1   2   >