summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_context.c
diff options
context:
space:
mode:
authorDaniel Vetter2014-08-06 15:04:53 +0200
committerDaniel Vetter2014-08-13 14:23:33 +0200
commitae6c4806927b8b0781ecc187aa16b10c820fc430 (patch)
tree259b85793ed699d01048377180a1a596c0f30d26 /drivers/gpu/drm/i915/i915_gem_context.c
parentdrm/i915: Initialize the aliasing ppgtt as part of global gtt (diff)
downloadkernel-qcow2-linux-ae6c4806927b8b0781ecc187aa16b10c820fc430.tar.gz
kernel-qcow2-linux-ae6c4806927b8b0781ecc187aa16b10c820fc430.tar.xz
kernel-qcow2-linux-ae6c4806927b8b0781ecc187aa16b10c820fc430.zip
drm/i915: Only track real ppgtt for a context
There's a bit a confusion since we track the global gtt, the aliasing and real ppgtt in the ctx->vm pointer. And not all callers really bother to check for the different cases and just presume that it points to a real ppgtt. Now looking closely we don't actually need ->vm to always point at an address space - the only place that cares actually has fixup code already to decide whether to look at the per-proces or the global address space. So switch to just tracking the ppgtt directly and ditch all the extraneous code. v2: Fixup the ppgtt debugfs file to not oops on a NULL ctx->ppgtt. Also drop the early exit - without aliasing ppgtt we want to dump all the ppgtts of the contexts if we have full ppgtt. v3: Actually git add the compile fix. Reviewed-by: Michel Thierry <michel.thierry@intel.com> Cc: "Thierry, Michel" <michel.thierry@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> OTC-Jira: VIZ-3724 [danvet: Resolve conflicts with execlist patches while applying.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_context.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 7093f5df9ee7..206bf2d6c554 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -135,19 +135,13 @@ static int get_context_size(struct drm_device *dev)
void i915_gem_context_free(struct kref *ctx_ref)
{
struct intel_context *ctx = container_of(ctx_ref,
- typeof(*ctx), ref);
- struct i915_hw_ppgtt *ppgtt = NULL;
+ typeof(*ctx), ref);
- if (i915.enable_execlists) {
- ppgtt = ctx_to_ppgtt(ctx);
+ if (i915.enable_execlists)
intel_lr_context_free(ctx);
- } else if (ctx->legacy_hw_ctx.rcs_state) {
- /* We refcount even the aliasing PPGTT to keep the code symmetric */
- if (USES_PPGTT(ctx->legacy_hw_ctx.rcs_state->base.dev))
- ppgtt = ctx_to_ppgtt(ctx);
- }
- i915_ppgtt_put(ppgtt);
+ i915_ppgtt_put(ctx->ppgtt);
+
if (ctx->legacy_hw_ctx.rcs_state)
drm_gem_object_unreference(&ctx->legacy_hw_ctx.rcs_state->base);
list_del(&ctx->link);
@@ -243,7 +237,6 @@ i915_gem_create_context(struct drm_device *dev,
bool create_vm)
{
const bool is_global_default_ctx = file_priv == NULL;
- struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_context *ctx;
int ret = 0;
@@ -277,15 +270,10 @@ i915_gem_create_context(struct drm_device *dev,
PTR_ERR(ppgtt));
ret = PTR_ERR(ppgtt);
goto err_unpin;
- } else
- ctx->vm = &ppgtt->base;
- } else if (USES_PPGTT(dev)) {
- /* For platforms which only have aliasing PPGTT, we fake the
- * address space and refcounting. */
- ctx->vm = &dev_priv->mm.aliasing_ppgtt->base;
- i915_ppgtt_get(dev_priv->mm.aliasing_ppgtt);
- } else
- ctx->vm = &dev_priv->gtt.base;
+ }
+
+ ctx->ppgtt = ppgtt;
+ }
return ctx;
@@ -543,7 +531,6 @@ static int do_switch(struct intel_engine_cs *ring,
{
struct drm_i915_private *dev_priv = ring->dev->dev_private;
struct intel_context *from = ring->last_context;
- struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to);
u32 hw_flags = 0;
bool uninitialized = false;
int ret, i;
@@ -571,8 +558,8 @@ static int do_switch(struct intel_engine_cs *ring,
*/
from = ring->last_context;
- if (USES_FULL_PPGTT(ring->dev)) {
- ret = ppgtt->switch_mm(ppgtt, ring, false);
+ if (to->ppgtt) {
+ ret = to->ppgtt->switch_mm(to->ppgtt, ring, false);
if (ret)
goto unpin_out;
}