diff --git a/kmscube.c b/kmscube.c
index 0252cd844f2e3562de121bd8a3d098c50b004c69..df2731d528971b5b8cd634bf737522d693173c80 100644 (file)
--- a/kmscube.c
+++ b/kmscube.c
uint8_t DISP_ID = 0;
uint8_t all_display = 0;
int8_t connector_id = -1;
+char* device = "/dev/dri/card0";
static struct {
EGLDisplay display;
static int init_drm(void)
{
- static const char *modules[] = {
- "omapdrm", "tilcdc", "tidss", "i915", "radeon", "nouveau", "vmwgfx", "exynos"
- };
drmModeRes *resources;
drmModeConnector *connector = NULL;
drmModeEncoder *encoder = NULL;
int i, j, k;
uint32_t maxRes, curRes;
- for (i = 0; i < ARRAY_SIZE(modules); i++) {
- printf("trying to load module %s...", modules[i]);
- drm.fd = drmOpen(modules[i], NULL);
- if (drm.fd < 0) {
- printf("failed.\n");
- } else {
- printf("success.\n");
- break;
- }
- }
-
+ /* Open default dri device */
+ drm.fd = open(device, O_RDWR | O_CLOEXEC);
if (drm.fd < 0) {
- printf("could not open drm device\n");
+ printf("could not open drm device %s\n", device);
return -1;
}
drmModeFreeConnector(drm.connectors[i]);
}
drmModeFreeResources(drm.resource_id);
- drmClose(drm.fd);
+ close(drm.fd);
return;
}
printf("\t-h : Help\n");
printf("\t-a : Enable all displays\n");
printf("\t-c <id> : Display using connector_id [if not specified, use the first connected connector]\n");
+ printf("\t-d /dev/dri/cardX : DRM device to be used. [If not specified, use /dev/dri/card0]\n");
printf("\t-n <number> (optional): Number of frames to render\n");
}
signal(SIGINT, kms_signalhandler);
signal(SIGTERM, kms_signalhandler);
- while ((opt = getopt(argc, argv, "ahc:n:")) != -1) {
+ while ((opt = getopt(argc, argv, "ahc:d:n:")) != -1) {
switch(opt) {
case 'a':
all_display = 1;
case 'c':
connector_id = atoi(optarg);
break;
+ case 'd':
+ device = optarg;
+ break;
case 'n':
frame_count = atoi(optarg);
break;