summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5f90636)
raw | patch | inline | side by side (parent: 5f90636)
author | Ramprasad N <x0038811@ti.com> | |
Fri, 1 Mar 2019 06:19:34 +0000 (11:49 +0530) | ||
committer | Ramprasad N <x0038811@ti.com> | |
Thu, 14 Mar 2019 10:15:54 +0000 (15:45 +0530) |
drmOpen() requires providing drm driver module names.
Use open()to access device with generic DRM calls
This generic open() usage will allow to execute kmscube in
vDRM as well as omapdrm devices.
This application also takes the device name /dev/dri/cardX
and if not provided, /dev/dri/card0 is used as default device.
Ex: kmscube -d /dev/dri/card1
Signed-off-by: Ramprasad N <x0038811@ti.com>
Use open()to access device with generic DRM calls
This generic open() usage will allow to execute kmscube in
vDRM as well as omapdrm devices.
This application also takes the device name /dev/dri/cardX
and if not provided, /dev/dri/card0 is used as default device.
Ex: kmscube -d /dev/dri/card1
Signed-off-by: Ramprasad N <x0038811@ti.com>
kmscube.c | patch | blob | history |
diff --git a/kmscube.c b/kmscube.c
index 0252cd844f2e3562de121bd8a3d098c50b004c69..d7ad1835c08d74ad29ccd516703a8624384f460b 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, "ahcd: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;