summaryrefslogtreecommitdiff
path: root/src/intel
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2015-04-14 09:51:46 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-04-14 12:41:33 +0800
commit368ebd9a2fffadd4927e9c9309773d1afd22543f (patch)
tree3b06d3350ec0c6d956901e279c2079ccbcba55d1 /src/intel
parent7ab4492706a0f8d66f50144a783e60fda869ebba (diff)
runtime: don't try to open nonexistent render nodes or device files.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/intel_driver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index a6b8a583..5adf09bc 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -223,6 +223,8 @@ intel_driver_open(intel_driver_t *intel, cl_context_prop props)
char card_name[20];
for(cardi = 0; cardi < 16; cardi++) {
sprintf(card_name, "/dev/dri/renderD%d", 128+cardi);
+ if (access(card_name, R_OK) != 0)
+ continue;
if(intel_driver_init_render(intel, card_name))
break;
}
@@ -232,6 +234,8 @@ intel_driver_open(intel_driver_t *intel, cl_context_prop props)
char card_name[20];
for(cardi = 0; cardi < 16; cardi++) {
sprintf(card_name, "/dev/dri/card%d", cardi);
+ if (access(card_name, R_OK) != 0)
+ continue;
if(intel_driver_init_master(intel, card_name))
break;
}
@@ -325,7 +329,6 @@ intel_driver_init_render(intel_driver_t *driver, const char* dev_name)
{
int dev_fd, ret;
- // usually dev_name = "/dev/dri/renderD%d"
dev_fd = open(dev_name, O_RDWR);
if (dev_fd == -1)
return 0;