diff options
author | Dave Airlie <airlied@redhat.com> | 2008-02-13 12:20:02 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-02-13 12:20:02 +1000 |
commit | db85ed25afc616acfaadb21facf6066354f9d490 (patch) | |
tree | 2d4c7eafac377543f8c5a01aced75079056c4e87 /libdrm | |
parent | f276c845bde4c712aa383540a2dd2055ecc00031 (diff) |
Revert "After the previous revert fix libdrm to start at minor 1"
This reverts commit f51dc37d75b0b1b8e5636f8f2c201e29986517ea.
Conflicts:
tests/modedemo/demo.c
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/xf86drm.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 8849f8bc..39a849c6 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -355,7 +355,7 @@ static int drmOpenMinor(int minor, int create, int type) { int fd; char buf[64]; - + if (create) return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type); @@ -421,15 +421,8 @@ static int drmOpenByBusid(const char *busid) const char *buf; drmSetVersion sv; - /* - * Open the first minor number that matches the driver name and isn't - * already in use. If it's in use it will have a busid assigned already. - * - * start at 1, as 0 is the control node, and we should use drmOpenControl - * for that. - */ drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid); - for (i = 1; i < DRM_MAX_MINOR; i++) { + for (i = 0; i < DRM_MAX_MINOR; i++) { fd = drmOpenMinor(i, 1, DRM_NODE_RENDER); drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd); if (fd >= 0) { @@ -474,14 +467,24 @@ static int drmOpenByName(const char *name) drmVersionPtr version; char * id; + if (!drmAvailable()) { + if (!drm_server_info) { + return -1; + } + else { + /* try to load the kernel module now */ + if (!drm_server_info->load_module(name)) { + drmMsg("[drm] failed to load kernel module \"%s\"\n", name); + return -1; + } + } + } + /* * Open the first minor number that matches the driver name and isn't * already in use. If it's in use it will have a busid assigned already. - * - * start at 1, as 0 is the control node, and we should use drmOpenControl - * for that. */ - for (i = 1; i < DRM_MAX_MINOR; i++) { + for (i = 0; i < DRM_MAX_MINOR; i++) { if ((fd = drmOpenMinor(i, 1, DRM_NODE_RENDER)) >= 0) { if ((version = drmGetVersion(fd))) { if (!strcmp(version->name, name)) { |