mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 11:08:03 +02:00
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>
This commit is contained in:
parent
a980024224
commit
0e78c35234
3 changed files with 6 additions and 42 deletions
|
|
@ -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 += \
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue