[Beignet] [PATCH] remove requirment as drm master in non-x environment
Guo Yejun
yejun.guo at intel.com
Mon Jul 14 16:19:02 PDT 2014
Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
src/intel/intel_driver.c | 20 +++++---------------
src/intel/intel_driver.h | 2 +-
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index 4a33661..2965bf7 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -294,7 +294,7 @@ intel_driver_init_shared(intel_driver_t *driver, dri_state_t *state)
if(state->driConnectedFlag != DRI2)
return 0;
intel_driver_init(driver, state->fd);
- driver->master = 0;
+ driver->need_close = 0;
return 1;
}
@@ -312,7 +312,7 @@ intel_driver_init_master(intel_driver_t *driver, const char* dev_name)
return 0;
}
- // Check that we're authenticated and the only opener
+ // Check that we're authenticated
memset(&client, 0, sizeof(drm_client_t));
int ret = ioctl(dev_fd, DRM_IOCTL_GET_CLIENT, &client);
assert (ret == 0);
@@ -323,16 +323,8 @@ intel_driver_init_master(intel_driver_t *driver, const char* dev_name)
return 0;
}
- 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;
- }
-
intel_driver_init(driver, dev_fd);
- driver->master = 1;
+ driver->need_close = 1;
return 1;
}
@@ -350,7 +342,7 @@ intel_driver_init_render(intel_driver_t *driver, const char* dev_name)
}
intel_driver_init(driver, dev_fd);
- driver->master = 1;
+ driver->need_close = 1;
return 1;
}
@@ -360,7 +352,7 @@ intel_driver_terminate(intel_driver_t *driver)
{
pthread_mutex_destroy(&driver->ctxmutex);
- if(driver->master)
+ if(driver->need_close)
close(driver->fd);
driver->fd = -1;
return 1;
@@ -385,7 +377,6 @@ intel_driver_unlock_hardware(intel_driver_t *driver)
LOCAL dri_bo*
intel_driver_share_buffer(intel_driver_t *driver, const char *sname, uint32_t name)
{
- assert(!driver->master);
dri_bo *bo = intel_bo_gem_create_from_name(driver->bufmgr,
sname,
name);
@@ -396,7 +387,6 @@ LOCAL uint32_t
intel_driver_shared_name(intel_driver_t *driver, dri_bo *bo)
{
uint32_t name;
- assert(!driver->master);
assert(bo);
dri_bo_flink(bo, &name);
return name;
diff --git a/src/intel/intel_driver.h b/src/intel/intel_driver.h
index 1ad0500..107fdfc 100644
--- a/src/intel/intel_driver.h
+++ b/src/intel/intel_driver.h
@@ -85,7 +85,7 @@ typedef struct intel_driver
sigset_t sa_mask;
pthread_mutex_t ctxmutex;
int locked;
- int master;
+ int need_close;
Display *x11_display;
struct dri_state *dri_ctx;
} intel_driver_t;
--
1.8.3.2
More information about the Beignet
mailing list