From 638261b3530106b70819c2fe0c3cd613c0d85777 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:23:11 +0200 Subject: gallium: Update the drm_api. Make it possible to pass state-tracker-specific data to the init_screen function, and even open the door for device-specific state-tracker screen initialization. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri2/dri_screen.c | 35 +-------------------------- src/gallium/state_trackers/dri2/dri_screen.h | 2 -- src/gallium/state_trackers/egl/egl_tracker.c | 2 +- src/gallium/state_trackers/xorg/xorg_driver.c | 2 +- 4 files changed, 3 insertions(+), 38 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c index ab5878a4bc..ab33003f51 100644 --- a/src/gallium/state_trackers/dri2/dri_screen.c +++ b/src/gallium/state_trackers/dri2/dri_screen.c @@ -67,37 +67,6 @@ static const __DRIextension *dri_screen_extensions[] = { NULL }; - -static void -dri_get_drm_minor(struct dri_screen *screen) -{ - /* TODO get the real minor */ - screen->minor = 0; -} - - -static void -dri_get_device_id(struct dri_screen *screen) -{ - char path[512]; - FILE *file; - - /* - * There must be a better way to get the deviceID. - * XXX this only works on Linux. - */ - snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", screen->minor); - file = fopen(path, "r"); - if (!file) { - return; - } - - fgets(path, sizeof(path), file); - sscanf(path, "%x", &screen->deviceID); - fclose(file); -} - - static const __DRIconfig ** dri_fill_in_modes(__DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, @@ -212,13 +181,11 @@ dri_init_screen2(__DRIscreenPrivate *sPriv) screen->sPriv = sPriv; screen->fd = sPriv->fd; - dri_get_drm_minor(screen); - dri_get_device_id(screen); sPriv->private = (void *) screen; sPriv->extensions = dri_screen_extensions; - screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, screen->deviceID); + screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL); if (!screen->pipe_screen) { debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__); goto fail; diff --git a/src/gallium/state_trackers/dri2/dri_screen.h b/src/gallium/state_trackers/dri2/dri_screen.h index fe2676d0be..3751ec6121 100644 --- a/src/gallium/state_trackers/dri2/dri_screen.h +++ b/src/gallium/state_trackers/dri2/dri_screen.h @@ -54,9 +54,7 @@ struct dri_screen struct dri_context *dummyContext; /* drm */ - int deviceID; int fd; - int minor; /* gallium */ struct pipe_winsys *pipe_winsys; diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index abdf84544f..8e62008461 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -146,7 +146,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) dev->drmFD = fd; drm_get_device_id(dev); - dev->screen = drm_api_hooks.create_screen(dev->drmFD, dev->deviceID); + dev->screen = drm_api_hooks.create_screen(dev->drmFD, NULL); if (!dev->screen) goto err_screen; dev->winsys = dev->screen->winsys; diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 8a2711e70c..45e831f0c2 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -476,7 +476,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } if (!ms->screen) { - ms->screen = drm_api_hooks.create_screen(ms->fd, ms->PciInfo->device_id); + ms->screen = drm_api_hooks.create_screen(ms->fd, NULL); if (!ms->screen) { FatalError("Could not init pipe_screen\n"); -- cgit v1.2.3