diff options
author | Chia-I Wu <[email protected]> | 2014-03-10 12:31:30 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-03-10 16:42:42 +0800 |
commit | 747627d0456eb14b2fb4c320c5bf0f084f3b2907 (patch) | |
tree | 02ef5afc14332fec41f0f8a46e341e2c499815aa /src/gallium/winsys/intel | |
parent | 72956ed374b73391d4d033722d3032fa6496b5cb (diff) |
ilo: require hardware logical context support
The code paths are not tested for a while, and have some known issues.
Diffstat (limited to 'src/gallium/winsys/intel')
-rw-r--r-- | src/gallium/winsys/intel/drm/intel_drm_winsys.c | 21 | ||||
-rw-r--r-- | src/gallium/winsys/intel/intel_winsys.h | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c index 5789114b39f..dfef9f4a914 100644 --- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c +++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c @@ -53,6 +53,7 @@ struct intel_winsys { /* these are protected by the mutex */ pipe_mutex mutex; + drm_intel_context *first_gem_ctx; struct drm_intel_decode *decode; }; @@ -145,6 +146,9 @@ probe_winsys(struct intel_winsys *winsys) info->has_llc = val; info->has_address_swizzling = test_address_swizzling(winsys); + winsys->first_gem_ctx = drm_intel_gem_context_create(winsys->bufmgr); + info->has_logical_context = (winsys->first_gem_ctx != NULL); + /* test TIMESTAMP read */ info->has_timestamp = test_reg_read(winsys, 0x2358); @@ -210,6 +214,9 @@ intel_winsys_destroy(struct intel_winsys *winsys) if (winsys->decode) drm_intel_decode_context_free(winsys->decode); + if (winsys->first_gem_ctx) + drm_intel_gem_context_destroy(winsys->first_gem_ctx); + pipe_mutex_destroy(winsys->mutex); drm_intel_bufmgr_destroy(winsys->bufmgr); FREE(winsys); @@ -224,8 +231,18 @@ intel_winsys_get_info(const struct intel_winsys *winsys) struct intel_context * intel_winsys_create_context(struct intel_winsys *winsys) { - return (struct intel_context *) - drm_intel_gem_context_create(winsys->bufmgr); + drm_intel_context *gem_ctx; + + /* try the preallocated context first */ + pipe_mutex_lock(winsys->mutex); + gem_ctx = winsys->first_gem_ctx; + winsys->first_gem_ctx = NULL; + pipe_mutex_unlock(winsys->mutex); + + if (!gem_ctx) + gem_ctx = drm_intel_gem_context_create(winsys->bufmgr); + + return (struct intel_context *) gem_ctx; } void diff --git a/src/gallium/winsys/intel/intel_winsys.h b/src/gallium/winsys/intel/intel_winsys.h index 8140588dfa2..3c9e6f267be 100644 --- a/src/gallium/winsys/intel/intel_winsys.h +++ b/src/gallium/winsys/intel/intel_winsys.h @@ -72,6 +72,7 @@ struct intel_winsys_info { int max_batch_size; bool has_llc; bool has_address_swizzling; + bool has_logical_context; /* valid registers for intel_winsys_read_reg() */ bool has_timestamp; |