summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2014-01-11 04:06:45 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2014-01-18 18:47:48 +0000
commit0e78c3523427190d649b02f586a6554889d74c2f (patch)
tree0ab656774f6dbaeef5292785a6c0316e3eaaeb73
parenta9800242244098fddcd2b963d8f5ccda5dea8290 (diff)
downloadexternal_mesa3d-0e78c3523427190d649b02f586a6554889d74c2f.zip
external_mesa3d-0e78c3523427190d649b02f586a6554889d74c2f.tar.gz
external_mesa3d-0e78c3523427190d649b02f586a6554889d74c2f.tar.bz2
st/egl: use loader util lib
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
-rw-r--r--src/gallium/state_trackers/egl/Makefile.am1
-rw-r--r--src/gallium/state_trackers/egl/SConscript3
-rw-r--r--src/gallium/state_trackers/egl/drm/native_drm.c44
3 files changed, 6 insertions, 42 deletions
diff --git a/src/gallium/state_trackers/egl/Makefile.am b/src/gallium/state_trackers/egl/Makefile.am
index 459fabc..bad14fe 100644
--- a/src/gallium/state_trackers/egl/Makefile.am
+++ b/src/gallium/state_trackers/egl/Makefile.am
@@ -63,6 +63,7 @@ endif
if HAVE_EGL_PLATFORM_DRM
libegl_la_SOURCES += $(drm_FILES)
+libegl_la_LIBADD = $(top_builddir)/src/loader/libloader.la
AM_CFLAGS += \
$(LIBDRM_CFLAGS)
AM_CPPFLAGS += \
diff --git a/src/gallium/state_trackers/egl/SConscript b/src/gallium/state_trackers/egl/SConscript
index 2a5db64..066a7fd 100644
--- a/src/gallium/state_trackers/egl/SConscript
+++ b/src/gallium/state_trackers/egl/SConscript
@@ -37,6 +37,9 @@ else:
'#/src/gbm/main',
'#/src/gallium/state_trackers/gbm',
])
+ env.Prepend(LIBS = [
+ libloader
+ ])
sources.append(env.ParseSourceList('Makefile.sources', 'drm_FILES'))
st_egl = env.ConvenienceLibrary(
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c
index c82bbe4..edaba43 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -30,15 +30,12 @@
#include "util/u_memory.h"
#include "egllog.h"
+#include "loader.h"
#include "native_drm.h"
#include "gbm_gallium_drmint.h"
-#ifdef HAVE_LIBUDEV
-#include <libudev.h>
-#endif
-
static boolean
drm_display_is_format_supported(struct native_display *ndpy,
enum pipe_format fmt, boolean is_color)
@@ -151,43 +148,6 @@ static struct native_display_buffer drm_display_buffer = {
drm_display_export_native_buffer
};
-static char *
-drm_get_device_name(int fd)
-{
- char *device_name = NULL;
-#ifdef HAVE_LIBUDEV
- struct udev *udev;
- struct udev_device *device;
- struct stat buf;
- const char *tmp;
-
- udev = udev_new();
- if (fstat(fd, &buf) < 0) {
- _eglLog(_EGL_WARNING, "failed to stat fd %d", fd);
- goto outudev;
- }
-
- device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
- if (device == NULL) {
- _eglLog(_EGL_WARNING,
- "could not create udev device for fd %d", fd);
- goto outdevice;
- }
-
- tmp = udev_device_get_devnode(device);
- if (!tmp)
- goto outdevice;
- device_name = strdup(tmp);
-
-outdevice:
- udev_device_unref(device);
-outudev:
- udev_unref(udev);
-
-#endif
- return device_name;
-}
-
#ifdef HAVE_WAYLAND_BACKEND
static int
@@ -230,7 +190,7 @@ drm_create_display(struct gbm_gallium_drm_device *gbmdrm, int own_gbm,
drmdpy->gbmdrm = gbmdrm;
drmdpy->own_gbm = own_gbm;
drmdpy->fd = gbmdrm->base.base.fd;
- drmdpy->device_name = drm_get_device_name(drmdpy->fd);
+ drmdpy->device_name = loader_get_device_name_for_fd(drmdpy->fd);
gbmdrm->lookup_egl_image = (struct pipe_resource *(*)(void *, void *))
event_handler->lookup_egl_image;