summaryrefslogtreecommitdiff
path: root/src/intel/intel_driver.c
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2014-05-19 13:52:22 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-05-19 12:54:22 +0800
commit881b26d9f2f4084b60ea4ca316c2fe21c3ce4535 (patch)
tree921a8a87d20504e1cb0ed8bff53cfcef9e8dbb2d /src/intel/intel_driver.c
parentdb86e8749b149a233611f380386ba5bf904d2ee3 (diff)
HSW: Use the drm flag I915_EXEC_ENABLE_SLM to set L3 control config.
Because LRI commands will be converted to NOOP, add the I915_EXEC_ENABLE_SLM flag to the drm kernal driver, to enable SLM in the L3. Set the flag when application use slm. Still keep the L3 config in the batch buffer for fulsim. Also create and use the openCL own context when exec, to avoid affect the other context. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Junyan He <junyan.he@inbox.com>
Diffstat (limited to 'src/intel/intel_driver.c')
-rw-r--r--src/intel/intel_driver.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index ef978357..08d6bc0c 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -106,6 +106,7 @@ intel_driver_delete(intel_driver_t *driver)
{
if (driver == NULL)
return;
+
if (driver->bufmgr)
drm_intel_bufmgr_destroy(driver->bufmgr);
cl_free(driver);
@@ -139,6 +140,21 @@ intel_driver_memman_init(intel_driver_t *driver)
drm_intel_bufmgr_gem_enable_reuse(driver->bufmgr);
}
+static void
+intel_driver_context_init(intel_driver_t *driver)
+{
+ driver->ctx = drm_intel_gem_context_create(driver->bufmgr);
+ assert(driver->ctx);
+}
+
+static void
+intel_driver_context_destroy(intel_driver_t *driver)
+{
+ if(driver->ctx)
+ drm_intel_gem_context_destroy(driver->ctx);
+ driver->ctx = NULL;
+}
+
static void
intel_driver_init(intel_driver_t *driver, int dev_fd)
{
@@ -151,6 +167,7 @@ intel_driver_init(intel_driver_t *driver, int dev_fd)
intel_driver_get_param(driver, I915_PARAM_CHIPSET_ID, &driver->device_id);
assert(res);
intel_driver_memman_init(driver);
+ intel_driver_context_init(driver);
#if EMULATE_GEN
driver->gen_ver = EMULATE_GEN;
@@ -364,6 +381,7 @@ intel_get_device_id(void)
assert(driver != NULL);
intel_driver_open(driver, NULL);
intel_device_id = driver->device_id;
+ intel_driver_context_destroy(driver);
intel_driver_close(driver);
intel_driver_terminate(driver);
intel_driver_delete(driver);
@@ -376,6 +394,7 @@ cl_intel_driver_delete(intel_driver_t *driver)
{
if (driver == NULL)
return;
+ intel_driver_context_destroy(driver);
intel_driver_close(driver);
intel_driver_terminate(driver);
intel_driver_delete(driver);