[Beignet] [PATCH 1/2] report errors if opening the DRI device fails
Mario Kicherer
dev at kicherer.org
Sun Dec 29 14:04:03 PST 2013
Signed-off-by: Mario Kicherer <dev at kicherer.org>
---
src/intel/intel_driver.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index cfbb302..f88a105 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -204,7 +204,7 @@ intel_driver_open(intel_driver_t *intel, cl_context_prop props)
}
if(!intel_driver_is_active(intel)) {
- printf("Trying to open directly...");
+ printf("Trying to open directly...\n");
char card_name[20];
for(cardi = 0; cardi < 16; cardi++) {
sprintf(card_name, "/dev/dri/card%d", cardi);
@@ -276,7 +276,10 @@ intel_driver_init_master(intel_driver_t *driver, const char* dev_name)
// usually dev_name = "/dev/dri/card%d"
dev_fd = open(dev_name, O_RDWR);
- if (dev_fd == -1) return 0;
+ if (dev_fd == -1) {
+ printf("open(\"%s\", O_RDWR) failed: %s\n", dev_name, strerror(errno));
+ return 0;
+ }
// Check that we're authenticated and the only opener
memset(&client, 0, sizeof(drm_client_t));
@@ -284,6 +287,7 @@ intel_driver_init_master(intel_driver_t *driver, const char* dev_name)
assert (ret == 0);
if (!client.auth) {
+ printf("%s not authenticated\n", dev_name);
close(dev_fd);
return 0;
}
@@ -291,6 +295,7 @@ intel_driver_init_master(intel_driver_t *driver, const char* dev_name)
client.idx = 1;
ret = ioctl(dev_fd, DRM_IOCTL_GET_CLIENT, &client);
if (ret != -1 || errno != EINVAL) {
+ printf("%s is already in use\n", dev_name);
close(dev_fd);
return 0;
}
--
1.8.3.2
More information about the Beignet
mailing list