Created
August 21, 2014 08:02
-
-
Save Constellation/a0130e59964c2450ae18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <errno.h> | |
#include "xf86drm.h" | |
#include "xf86drmMode.h" | |
#include "nouveau_drm.h" | |
#include "nouveau.h" | |
int | |
pvdrm_device_open(const char *busid, struct nouveau_device **pdev) | |
{ | |
int ret = -ENODEV, fd = drmOpen("pvdrm", busid); | |
if (fd >= 0) { | |
ret = nouveau_device_wrap(fd, 1, pdev); | |
if (ret) | |
drmClose(fd); | |
} | |
return ret; | |
} | |
int main(int argc, char** argv) { | |
struct nouveau_device *dev; | |
struct nouveau_client *priv; | |
if (!drmAvailable()) { | |
printf("not available\n"); | |
return 1; | |
} | |
int ret = -ENODEV; | |
int fd = drmOpen("pvdrm", NULL); | |
if (fd < 0) { | |
printf("fail\n"); | |
return 1; | |
} | |
if (pvdrm_device_open(0, &dev)) { | |
printf("out\n"); | |
return 1; | |
} | |
printf("%u\n", dev->chipset); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment