summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@sasori.boston.redhat.com>2009-01-15 12:50:21 -0500
committerKristian Høgsberg <krh@sasori.boston.redhat.com>2009-01-16 06:38:14 -0500
commitaa68fe346a01c394c90e246dd647e6d0947850f8 (patch)
tree4f4dd0f2ee77c5792c6f8e1031a3ecb812c63f0a
parentff52fbaaf87ff75bfdcb9c2766ba2f76f2d9bab2 (diff)
downloadwayland-aa68fe346a01c394c90e246dd647e6d0947850f8.tar.gz
wayland-aa68fe346a01c394c90e246dd647e6d0947850f8.tar.xz
wayland-aa68fe346a01c394c90e246dd647e6d0947850f8.zip
Update to track udev API change in eagle.
-rw-r--r--configure.ac2
-rw-r--r--gears.c7
-rw-r--r--wayland-system-compositor.c49
3 files changed, 8 insertions, 50 deletions
diff --git a/configure.ac b/configure.ac
index fdf0314..4696617 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ PKG_CHECK_MODULES(LIBDRM, [libdrm])
PKG_CHECK_MODULES(EGL_COMPOSITOR, [eagle libpng cairo gdk-pixbuf-2.0 libudev])
PKG_CHECK_MODULES(GL_COMPOSITOR, [gl x11])
-PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0])
+PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0 libudev])
if test $CC = gcc; then
GCC_CFLAGS="-Wall -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
diff --git a/gears.c b/gears.c
index 276c339..91fa59d 100644
--- a/gears.c
+++ b/gears.c
@@ -341,9 +341,14 @@ gears_create(struct wl_display *display, int fd)
const int x = 200, y = 200, width = 450, height = 500;
EGLint major, minor, count;
EGLConfig configs[64];
+ struct udev *udev;
+ struct udev_device *device;
struct gears *gears;
int i;
+ udev = udev_new();
+ device = udev_device_new_from_syspath(udev, "/sys/class/drm/card0");
+
gears = malloc(sizeof *gears);
memset(gears, 0, sizeof *gears);
gears->wl_display = display;
@@ -351,7 +356,7 @@ gears_create(struct wl_display *display, int fd)
gears->window = window_create(display, fd, "Wayland Gears",
x, y, width, height);
- gears->display = eglCreateDisplayNative("/dev/dri/card0", "i965");
+ gears->display = eglCreateDisplayNative(device);
if (gears->display == NULL)
die("failed to create egl display\n");
diff --git a/wayland-system-compositor.c b/wayland-system-compositor.c
index 5a60cbb..12287f9 100644
--- a/wayland-system-compositor.c
+++ b/wayland-system-compositor.c
@@ -793,44 +793,6 @@ get_udev_property(struct udev_device *device, const char *name)
return NULL;
}
-struct dri_driver_entry {
- uint32_t vendor_id;
- uint32_t chip_id;
- const char *driver;
-};
-
-static const struct dri_driver_entry driver_map[] = {
- /* FIXME: We need to extract this table from the dri drivers
- * and store it on disk. For now, map my i965 to i965,
- * anything else intel to i915 and that's that. */
-
- { 0x8086, 0x2a02, "i965" },
- { 0x8086, ~0, "i915" },
- { 0, }
-};
-
-static const char *
-get_driver_for_device(struct udev_device *device)
-{
- struct udev_device *parent;
- const char *pci_id;
- uint32_t vendor_id, chip_id;
- int i;
-
- parent = udev_device_get_parent(device);
- pci_id = get_udev_property(parent, "PCI_ID");
- if (sscanf(pci_id, "%x:%x", &vendor_id, &chip_id) != 2)
- return NULL;
-
- for (i = 0; i < ARRAY_LENGTH(driver_map); i++) {
- if (driver_map[i].vendor_id == vendor_id &&
- (driver_map[i].chip_id == ~0 || driver_map[i].chip_id == chip_id))
- return driver_map[i].driver;
- }
-
- return NULL;
-}
-
static int
init_egl(struct egl_compositor *ec, struct udev_device *device)
{
@@ -841,18 +803,9 @@ init_egl(struct egl_compositor *ec, struct udev_device *device)
EGL_NONE
};
- const char *path, *driver;
EGLint major, minor;
- path = udev_device_get_devnode(device);
- driver = get_driver_for_device(device);
- if (driver == NULL) {
- fprintf(stderr, "didn't find driver for %s\n",
- udev_device_get_devpath(device));
- return -1;
- }
-
- ec->display = eglCreateDisplayNative(path, driver);
+ ec->display = eglCreateDisplayNative(device);
if (ec->display == NULL) {
fprintf(stderr, "failed to create display\n");
return -1;