diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-08-06 09:04:48 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-08-13 08:23:29 -0400 |
commit | 841cd7737557785c0f215b0984c06aaaaa882302 (patch) | |
tree | a58dca612ff402b33b63b678e7ebb841ea731b29 /drivers/gpu/drm/i915/i915_drv.h | |
parent | 4d884705dababd7d0f3f12796bc7b45e84962596 (diff) |
drm/i915: Only refcount ppgtt if it actually is one
This essentially unbreaks non-ppgtt operation where we'd scribble over
random memory.
While at it give the vm_to_ppgtt function a proper prefix and make it
a bit more paranoid.
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 101fc637eb46..454badf31dfd 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -2512,6 +2512,15 @@ static inline bool i915_is_ggtt(struct i915_address_space *vm) | |||
2512 | return vm == ggtt; | 2512 | return vm == ggtt; |
2513 | } | 2513 | } |
2514 | 2514 | ||
2515 | static inline struct i915_hw_ppgtt * | ||
2516 | i915_vm_to_ppgtt(struct i915_address_space *vm) | ||
2517 | { | ||
2518 | WARN_ON(i915_is_ggtt(vm)); | ||
2519 | |||
2520 | return container_of(vm, struct i915_hw_ppgtt, base); | ||
2521 | } | ||
2522 | |||
2523 | |||
2515 | static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj) | 2524 | static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj) |
2516 | { | 2525 | { |
2517 | return i915_gem_obj_bound(obj, obj_to_ggtt(obj)); | 2526 | return i915_gem_obj_bound(obj, obj_to_ggtt(obj)); |
@@ -2547,7 +2556,6 @@ void i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj); | |||
2547 | 2556 | ||
2548 | /* i915_gem_context.c */ | 2557 | /* i915_gem_context.c */ |
2549 | #define ctx_to_ppgtt(ctx) container_of((ctx)->vm, struct i915_hw_ppgtt, base) | 2558 | #define ctx_to_ppgtt(ctx) container_of((ctx)->vm, struct i915_hw_ppgtt, base) |
2550 | #define vm_to_ppgtt(vm) container_of(vm, struct i915_hw_ppgtt, base) | ||
2551 | int __must_check i915_gem_context_init(struct drm_device *dev); | 2559 | int __must_check i915_gem_context_init(struct drm_device *dev); |
2552 | void i915_gem_context_fini(struct drm_device *dev); | 2560 | void i915_gem_context_fini(struct drm_device *dev); |
2553 | void i915_gem_context_reset(struct drm_device *dev); | 2561 | void i915_gem_context_reset(struct drm_device *dev); |