Skip to content

Commit

Permalink
drm/i915: extract intel_gpu_reset
Browse files Browse the repository at this point in the history
Slightly cleans up the code and could be useful for e.g. Ben
Widawsky's hw context patches.

v2: New colours!

Cc: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Daniel Vetter committed May 5, 2012
1 parent bcbc324 commit 350d270
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions drivers/gpu/drm/i915/i915_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,29 @@ static int gen6_do_reset(struct drm_device *dev, u8 flags)
return ret;
}

static int intel_gpu_reset(struct drm_device *dev, u8 flags)
{
int ret = -ENODEV;

switch (INTEL_INFO(dev)->gen) {
case 7:
case 6:
ret = gen6_do_reset(dev, flags);
break;
case 5:
ret = ironlake_do_reset(dev, flags);
break;
case 4:
ret = i965_do_reset(dev, flags);
break;
case 2:
ret = i8xx_do_reset(dev, flags);
break;
}

return ret;
}

/**
* i915_reset - reset chip after a hang
* @dev: drm device to reset
Expand Down Expand Up @@ -800,23 +823,11 @@ int i915_reset(struct drm_device *dev, u8 flags)
i915_gem_reset(dev);

ret = -ENODEV;
if (get_seconds() - dev_priv->last_gpu_reset < 5) {
if (get_seconds() - dev_priv->last_gpu_reset < 5)
DRM_ERROR("GPU hanging too fast, declaring wedged!\n");
} else switch (INTEL_INFO(dev)->gen) {
case 7:
case 6:
ret = gen6_do_reset(dev, flags);
break;
case 5:
ret = ironlake_do_reset(dev, flags);
break;
case 4:
ret = i965_do_reset(dev, flags);
break;
case 2:
ret = i8xx_do_reset(dev, flags);
break;
}
else
ret = intel_gpu_reset(dev, flags);

dev_priv->last_gpu_reset = get_seconds();
if (ret) {
DRM_ERROR("Failed to reset chip.\n");
Expand Down

0 comments on commit 350d270

Please sign in to comment.