Rev 3480 | Rev 4104 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3480 | Rev 3746 | ||
---|---|---|---|
Line 93... | Line 93... | ||
93 | * I've seen in a spec to date, and that was a workaround for a non-shipping |
93 | * I've seen in a spec to date, and that was a workaround for a non-shipping |
94 | * part. It should be safe to decrease this, but it's more future proof as is. |
94 | * part. It should be safe to decrease this, but it's more future proof as is. |
95 | */ |
95 | */ |
96 | #define CONTEXT_ALIGN (64<<10) |
96 | #define CONTEXT_ALIGN (64<<10) |
Line 97... | Line -... | ||
97 | - | ||
98 | #if 0 |
- | |
99 | 97 | ||
100 | static struct i915_hw_context * |
98 | static struct i915_hw_context * |
101 | i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); |
99 | i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); |
Line 102... | Line 100... | ||
102 | static int do_switch(struct i915_hw_context *to); |
100 | static int do_switch(struct i915_hw_context *to); |
Line 152... | Line 150... | ||
152 | kfree(ctx); |
150 | kfree(ctx); |
153 | DRM_DEBUG_DRIVER("Context object allocated failed\n"); |
151 | DRM_DEBUG_DRIVER("Context object allocated failed\n"); |
154 | return ERR_PTR(-ENOMEM); |
152 | return ERR_PTR(-ENOMEM); |
155 | } |
153 | } |
Line -... | Line 154... | ||
- | 154 | ||
- | 155 | if (INTEL_INFO(dev)->gen >= 7) { |
|
- | 156 | ret = i915_gem_object_set_cache_level(ctx->obj, |
|
- | 157 | I915_CACHE_LLC_MLC); |
|
- | 158 | if (ret) |
|
- | 159 | goto err_out; |
|
- | 160 | } |
|
156 | 161 | ||
157 | /* The ring associated with the context object is handled by the normal |
162 | /* The ring associated with the context object is handled by the normal |
158 | * object tracking code. We give an initial ring value simple to pass an |
163 | * object tracking code. We give an initial ring value simple to pass an |
159 | * assertion in the context switch code. |
164 | * assertion in the context switch code. |
160 | */ |
165 | */ |
Line 222... | Line 227... | ||
222 | i915_gem_object_unpin(ctx->obj); |
227 | i915_gem_object_unpin(ctx->obj); |
223 | err_destroy: |
228 | err_destroy: |
224 | do_destroy(ctx); |
229 | do_destroy(ctx); |
225 | return ret; |
230 | return ret; |
226 | } |
231 | } |
227 | #endif |
- | |
Line 228... | Line 232... | ||
228 | 232 | ||
229 | void i915_gem_context_init(struct drm_device *dev) |
233 | void i915_gem_context_init(struct drm_device *dev) |
230 | { |
234 | { |
Line 231... | Line -... | ||
231 | struct drm_i915_private *dev_priv = dev->dev_private; |
- | |
232 | 235 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
233 | #if 0 |
236 | |
234 | if (!HAS_HW_CONTEXTS(dev)) { |
237 | if (!HAS_HW_CONTEXTS(dev)) { |
235 | dev_priv->hw_contexts_disabled = true; |
238 | dev_priv->hw_contexts_disabled = true; |
Line 252... | Line 255... | ||
252 | dev_priv->hw_contexts_disabled = true; |
255 | dev_priv->hw_contexts_disabled = true; |
253 | return; |
256 | return; |
254 | } |
257 | } |
Line 255... | Line 258... | ||
255 | 258 | ||
256 | DRM_DEBUG_DRIVER("HW context support initialized\n"); |
- | |
257 | #endif |
- | |
258 | 259 | DRM_DEBUG_DRIVER("HW context support initialized\n"); |
|
Line 259... | Line -... | ||
259 | } |
- | |
260 | 260 | } |
|
261 | #if 0 |
261 | |
262 | void i915_gem_context_fini(struct drm_device *dev) |
262 | void i915_gem_context_fini(struct drm_device *dev) |
Line 263... | Line 263... | ||
263 | { |
263 | { |
264 | struct drm_i915_private *dev_priv = dev->dev_private; |
264 | struct drm_i915_private *dev_priv = dev->dev_private; |
Line 265... | Line 265... | ||
265 | 265 | ||
266 | if (dev_priv->hw_contexts_disabled) |
266 | if (dev_priv->hw_contexts_disabled) |
267 | return; |
267 | return; |
268 | 268 | ||
Line 269... | Line 269... | ||
269 | /* The only known way to stop the gpu from accessing the hw context is |
269 | /* The only known way to stop the gpu from accessing the hw context is |
Line 270... | Line 270... | ||
270 | * to reset it. Do this as the very last operation to avoid confusing |
270 | * to reset it. Do this as the very last operation to avoid confusing |
271 | * other code, leading to spurious errors. */ |
271 | * other code, leading to spurious errors. */ |
Line 290... | Line 290... | ||
290 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) |
290 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) |
291 | { |
291 | { |
292 | struct drm_i915_file_private *file_priv = file->driver_priv; |
292 | struct drm_i915_file_private *file_priv = file->driver_priv; |
Line 293... | Line 293... | ||
293 | 293 | ||
294 | mutex_lock(&dev->struct_mutex); |
294 | mutex_lock(&dev->struct_mutex); |
295 | idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); |
295 | // idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); |
296 | idr_destroy(&file_priv->context_idr); |
296 | idr_destroy(&file_priv->context_idr); |
297 | mutex_unlock(&dev->struct_mutex); |
297 | mutex_unlock(&dev->struct_mutex); |
Line 298... | Line 298... | ||
298 | } |
298 | } |
Line 418... | Line 418... | ||
418 | ring->last_context_obj = to->obj; |
418 | ring->last_context_obj = to->obj; |
419 | to->is_initialized = true; |
419 | to->is_initialized = true; |
Line 420... | Line 420... | ||
420 | 420 | ||
421 | return 0; |
421 | return 0; |
422 | } |
- | |
Line 423... | Line 422... | ||
423 | #endif |
422 | } |
424 | 423 | ||
425 | /** |
424 | /** |
426 | * i915_switch_context() - perform a GPU context switch. |
425 | * i915_switch_context() - perform a GPU context switch. |
Line 443... | Line 442... | ||
443 | struct i915_hw_context *to; |
442 | struct i915_hw_context *to; |
Line 444... | Line 443... | ||
444 | 443 | ||
445 | if (dev_priv->hw_contexts_disabled) |
444 | if (dev_priv->hw_contexts_disabled) |
Line 446... | Line -... | ||
446 | return 0; |
- | |
447 | 445 | return 0; |
|
448 | #if 0 |
446 | |
Line 449... | Line 447... | ||
449 | if (ring != &dev_priv->ring[RCS]) |
447 | if (ring != &dev_priv->ring[RCS]) |
450 | return 0; |
448 | return 0; |
Line 459... | Line 457... | ||
459 | if (to == NULL) |
457 | if (to == NULL) |
460 | return -ENOENT; |
458 | return -ENOENT; |
461 | } |
459 | } |
Line 462... | Line 460... | ||
462 | 460 | ||
463 | return do_switch(to); |
- | |
464 | #endif |
- | |
465 | - | ||
466 | return 0; |
461 | return do_switch(to); |
Line 467... | Line 462... | ||
467 | } |
462 | } |
468 | 463 | ||
469 | #if 0 |
464 | #if 0 |