From: Daniel Vetter Date: Wed, 18 Dec 2013 15:23:37 +0000 (+0100) Subject: Merge commit drm-intel-fixes into topic/ppgtt X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=3d7f0f9dcca6b40dd347bbf3508c642002e0a561;p=openwrt%2Fstaging%2Fblogic.git Merge commit drm-intel-fixes into topic/ppgtt I need the tricky do_switch fix before I can merge the final piece of the ppgtt enabling puzzle. Otherwise the conflict will be a real pain to resolve since the do_switch hunk from -fixes must be placed at the exact right place within a hunk in the next patch. Conflicts: drivers/gpu/drm/i915/i915_gem_context.c drivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/intel_display.c Signed-off-by: Daniel Vetter --- 3d7f0f9dcca6b40dd347bbf3508c642002e0a561 diff --cc drivers/gpu/drm/i915/i915_gem_context.c index d3a17ef78ba6,b0f42b9ca037..165a5c7d9424 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@@ -515,24 -347,13 +515,22 @@@ void i915_gem_context_close(struct drm_ { struct drm_i915_file_private *file_priv = file->driver_priv; + if (!HAS_HW_CONTEXTS(dev)) { + kfree(file_priv->private_default_ctx); + return; + } + - mutex_lock(&dev->struct_mutex); idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); + i915_gem_context_unreference(file_priv->private_default_ctx); idr_destroy(&file_priv->context_idr); - mutex_unlock(&dev->struct_mutex); } -static struct i915_hw_context * +struct i915_hw_context * i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id) { + if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev)) + return file_priv->private_default_ctx; + return (struct i915_hw_context *)idr_find(&file_priv->context_idr, id); } @@@ -615,10 -433,12 +621,12 @@@ static int do_switch(struct intel_ring_ * that thanks to write = false in this call and us not setting any gpu * write domains when putting a context object onto the active list * (when switching away from it), this won't block. - * XXX: We need a real interface to do this instead of trickery. */ + * + * XXX: We need a real interface to do this instead of trickery. + */ ret = i915_gem_object_set_to_gtt_domain(to->obj, false); if (ret) { - i915_gem_object_unpin(to->obj); + i915_gem_object_ggtt_unpin(to->obj); return ret; } diff --cc drivers/gpu/drm/i915/i915_gem_execbuffer.c index e78c5c0e33d8,b7e787fb4649..8779d75bee1f --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@@ -197,7 -190,28 +200,28 @@@ static struct i915_vma *eb_get_vma(stru } } - static void eb_destroy(struct eb_vmas *eb) { + static void + i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma) + { + struct drm_i915_gem_exec_object2 *entry; + struct drm_i915_gem_object *obj = vma->obj; + + if (!drm_mm_node_allocated(&vma->node)) + return; + + entry = vma->exec_entry; + + if (entry->flags & __EXEC_OBJECT_HAS_FENCE) + i915_gem_object_unpin_fence(obj); + + if (entry->flags & __EXEC_OBJECT_HAS_PIN) - i915_gem_object_unpin(obj); ++ vma->pin_count--; + + entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN); + } + + static void eb_destroy(struct eb_vmas *eb) + { while (!list_empty(&eb->vmas)) { struct i915_vma *vma; diff --cc drivers/gpu/drm/i915/intel_display.c index 596ad09f0e51,8b8bde7dce53..af3717a8a463 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@@ -6589,7 -6402,7 +6589,7 @@@ static void hsw_restore_lcpll(struct dr /* Make sure we're not on PC8 state before disabling PC8, otherwise * we'll hang the machine! */ - dev_priv->uncore.funcs.force_wake_get(dev_priv, FORCEWAKE_ALL); - gen6_gt_force_wake_get(dev_priv); ++ gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); if (val & LCPLL_POWER_DOWN_ALLOW) { val &= ~LCPLL_POWER_DOWN_ALLOW; @@@ -6623,7 -6436,7 +6623,7 @@@ DRM_ERROR("Switching back to LCPLL failed\n"); } - dev_priv->uncore.funcs.force_wake_put(dev_priv, FORCEWAKE_ALL); - gen6_gt_force_wake_put(dev_priv); ++ gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL); } void hsw_enable_pc8_work(struct work_struct *__work) diff --cc drivers/gpu/drm/i915/intel_pm.c index cba4be88eddb,e0dec95c764e..0731338c0bfd --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@@ -6176,10 -6120,17 +6177,10 @@@ int vlv_freq_opcode(struct drm_i915_pri return -1; } - val /= mult; - val -= base / mult; - val += 0xbd; - - if (val > 0xea) - val = 0xea; - - return val; + return DIV_ROUND_CLOSEST(4 * mul * val, dev_priv->mem_freq) + 0xbd - 6; } - void intel_pm_init(struct drm_device *dev) + void intel_pm_setup(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private;