diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-02-09 11:15:47 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-02-09 15:25:23 -0500 |
commit | 7bddb01fb9697afd5d39bb69dd9f782a28063101 (patch) | |
tree | cf8d8b67d4bac35a611073a6723228d074960036 /drivers/gpu/drm/i915/i915_gem.c | |
parent | 1d2a314c97ceaf383de8e23cdde46729927d433c (diff) |
drm/i915: ppgtt binding/unbinding support
This adds support to bind/unbind objects and wires it up. Objects are
only put into the ppgtt when necessary, i.e. at execbuf time.
Objects are still unconditionally put into the global gtt.
v2: Kill the quick hack and explicitly pass cache_level to ppgtt_bind
like for the global gtt function. Noticed by Chris Wilson.
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 27fe07a2fd33..59092997bcfb 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2020,6 +2020,7 @@ static void i915_gem_object_finish_gtt(struct drm_i915_gem_object *obj) | |||
2020 | int | 2020 | int |
2021 | i915_gem_object_unbind(struct drm_i915_gem_object *obj) | 2021 | i915_gem_object_unbind(struct drm_i915_gem_object *obj) |
2022 | { | 2022 | { |
2023 | drm_i915_private_t *dev_priv = obj->base.dev->dev_private; | ||
2023 | int ret = 0; | 2024 | int ret = 0; |
2024 | 2025 | ||
2025 | if (obj->gtt_space == NULL) | 2026 | if (obj->gtt_space == NULL) |
@@ -2064,6 +2065,11 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj) | |||
2064 | trace_i915_gem_object_unbind(obj); | 2065 | trace_i915_gem_object_unbind(obj); |
2065 | 2066 | ||
2066 | i915_gem_gtt_unbind_object(obj); | 2067 | i915_gem_gtt_unbind_object(obj); |
2068 | if (obj->has_aliasing_ppgtt_mapping) { | ||
2069 | i915_ppgtt_unbind_object(dev_priv->mm.aliasing_ppgtt, obj); | ||
2070 | obj->has_aliasing_ppgtt_mapping = 0; | ||
2071 | } | ||
2072 | |||
2067 | i915_gem_object_put_pages_gtt(obj); | 2073 | i915_gem_object_put_pages_gtt(obj); |
2068 | 2074 | ||
2069 | list_del_init(&obj->gtt_list); | 2075 | list_del_init(&obj->gtt_list); |
@@ -2882,6 +2888,8 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) | |||
2882 | int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, | 2888 | int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, |
2883 | enum i915_cache_level cache_level) | 2889 | enum i915_cache_level cache_level) |
2884 | { | 2890 | { |
2891 | struct drm_device *dev = obj->base.dev; | ||
2892 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
2885 | int ret; | 2893 | int ret; |
2886 | 2894 | ||
2887 | if (obj->cache_level == cache_level) | 2895 | if (obj->cache_level == cache_level) |
@@ -2910,6 +2918,9 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, | |||
2910 | } | 2918 | } |
2911 | 2919 | ||
2912 | i915_gem_gtt_rebind_object(obj, cache_level); | 2920 | i915_gem_gtt_rebind_object(obj, cache_level); |
2921 | if (obj->has_aliasing_ppgtt_mapping) | ||
2922 | i915_ppgtt_bind_object(dev_priv->mm.aliasing_ppgtt, | ||
2923 | obj, cache_level); | ||
2913 | } | 2924 | } |
2914 | 2925 | ||
2915 | if (cache_level == I915_CACHE_NONE) { | 2926 | if (cache_level == I915_CACHE_NONE) { |