Running on bare hardware
Marty Jack
martyj19 at comcast.net
Sun Feb 6 12:03:00 PST 2011
I spent the weekend learning my way around and debugging the DRM compositor running on bare hardware. Successful, but some issues and observations.
As is documented, you need to make sure you have your video and input devices labelled with the udev property WAYLAND_SEAT="1". I have a program that is the enumeration code from the compositor snipped out that will print out the labelled devices, which you will find at the end. Link with -ludev.
You need Mesa git in order to have the glTexSubImage2D of BGRA_EXT accepted.
It is a great pity that the DRM topology ioctls require you to be the owner of the device (DRM_MASTER in the kernel sources drivers/gpu/drm/drm_drv.c). Although it does mitigate some of the race conditions, which could have been solved other ways. This means that sensing the topology, which is big and complicated and full of substructure, will have to be mediated by the compositor when it comes time to do xrandr. We should think about exposing some of these things in shared memory. You also have to be root to be the compositor.
(It is also a great pity that whoever designed the modesetting ioctls thought _u64 was a good type for all the pointer values. Whoever designed the original ioctls used pointer types very successfully.)
There is a bug in the connector enumeration. I happen to have two monitors and what I spent most of the time on was figuring out why the screen wouldn't light. It turns out that the CRTC gets connected to the first monitor and then the same CRTC gets selected for the second monitor and so the first monitor doesn't have one any more. There are two ways of fixing this short term, having the connector enumeration stop when it has found one monitor, or having an allocator over CRTCs. Kristian if you could suggest which way you want to go for now I can do a patch.
There is a buglet or two in the way the socket is set up. It isn't world write, so you have to be root to run a client, and it should be unlinked if it is already present, making sure you don't unlink something important or introduce a symlink attack.
Also if for example you have wayland.png as the background, the cursor leaves trails wherever the background is transparent.
Beyond that, I had an excellent time running a few clients and it will be nice to have the toolkit backends so we can have more. I must say I am missing autorepeat in the terminal. Can someone comment on who will be running the timers for DPMS and timed screenlock and autorepeat?
#include <libudev.h>
#include <stdio.h>
int main(int argc, char * argv [])
{
struct udev * u = udev_new();
struct udev_enumerate * e_v = udev_enumerate_new(u);
udev_enumerate_add_match_subsystem(e_v, "drm");
udev_enumerate_add_match_property(e_v, "WAYLAND_SEAT", "1");
udev_enumerate_scan_devices(e_v);
struct udev_list_entry * entry_v;
udev_list_entry_foreach(entry_v, udev_enumerate_get_list_entry(e_v))
{
const char * path = udev_list_entry_get_name(entry_v);
struct udev_device * device = udev_device_new_from_syspath(u, path);
printf("%s %s\n", path, udev_device_get_devnode(device));
}
udev_enumerate_unref(e_v);
struct udev_enumerate * e_i = udev_enumerate_new(u);
udev_enumerate_add_match_subsystem(e_i, "input");
udev_enumerate_add_match_property(e_i, "WAYLAND_SEAT", "1");
udev_enumerate_scan_devices(e_i);
struct udev_list_entry * entry_i;
udev_list_entry_foreach(entry_i, udev_enumerate_get_list_entry(e_i))
{
const char * path = udev_list_entry_get_name(entry_i);
struct udev_device * device = udev_device_new_from_syspath(u, path);
printf("%s %s\n", path, udev_device_get_devnode(device));
}
udev_enumerate_unref(e_i);
return 0;
}
More information about the wayland-devel
mailing list