diff options
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 8 |
5 files changed, 30 insertions, 16 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 6ccdf954b1ca..970714bb77a2 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -2795,19 +2795,19 @@ void i915_gem_restore_fences(struct drm_device *dev); | |||
2795 | 2795 | ||
2796 | unsigned long | 2796 | unsigned long |
2797 | i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o, | 2797 | i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o, |
2798 | enum i915_ggtt_view_type view); | 2798 | const struct i915_ggtt_view *view); |
2799 | unsigned long | 2799 | unsigned long |
2800 | i915_gem_obj_offset(struct drm_i915_gem_object *o, | 2800 | i915_gem_obj_offset(struct drm_i915_gem_object *o, |
2801 | struct i915_address_space *vm); | 2801 | struct i915_address_space *vm); |
2802 | static inline unsigned long | 2802 | static inline unsigned long |
2803 | i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *o) | 2803 | i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *o) |
2804 | { | 2804 | { |
2805 | return i915_gem_obj_ggtt_offset_view(o, I915_GGTT_VIEW_NORMAL); | 2805 | return i915_gem_obj_ggtt_offset_view(o, &i915_ggtt_view_normal); |
2806 | } | 2806 | } |
2807 | 2807 | ||
2808 | bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o); | 2808 | bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o); |
2809 | bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, | 2809 | bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, |
2810 | enum i915_ggtt_view_type view); | 2810 | const struct i915_ggtt_view *view); |
2811 | bool i915_gem_obj_bound(struct drm_i915_gem_object *o, | 2811 | bool i915_gem_obj_bound(struct drm_i915_gem_object *o, |
2812 | struct i915_address_space *vm); | 2812 | struct i915_address_space *vm); |
2813 | 2813 | ||
@@ -2855,7 +2855,7 @@ i915_vm_to_ppgtt(struct i915_address_space *vm) | |||
2855 | 2855 | ||
2856 | static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj) | 2856 | static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj) |
2857 | { | 2857 | { |
2858 | return i915_gem_obj_ggtt_bound_view(obj, I915_GGTT_VIEW_NORMAL); | 2858 | return i915_gem_obj_ggtt_bound_view(obj, &i915_ggtt_view_normal); |
2859 | } | 2859 | } |
2860 | 2860 | ||
2861 | static inline unsigned long | 2861 | static inline unsigned long |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c13e65994654..4ca3dab77fa4 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -4129,7 +4129,7 @@ i915_gem_object_do_pin(struct drm_i915_gem_object *obj, | |||
4129 | 4129 | ||
4130 | if (i915_vma_misplaced(vma, alignment, flags)) { | 4130 | if (i915_vma_misplaced(vma, alignment, flags)) { |
4131 | unsigned long offset; | 4131 | unsigned long offset; |
4132 | offset = ggtt_view ? i915_gem_obj_ggtt_offset_view(obj, ggtt_view->type) : | 4132 | offset = ggtt_view ? i915_gem_obj_ggtt_offset_view(obj, ggtt_view) : |
4133 | i915_gem_obj_offset(obj, vm); | 4133 | i915_gem_obj_offset(obj, vm); |
4134 | WARN(vma->pin_count, | 4134 | WARN(vma->pin_count, |
4135 | "bo is already pinned in %s with incorrect alignment:" | 4135 | "bo is already pinned in %s with incorrect alignment:" |
@@ -4228,7 +4228,7 @@ i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj, | |||
4228 | 4228 | ||
4229 | BUG_ON(!vma); | 4229 | BUG_ON(!vma); |
4230 | WARN_ON(vma->pin_count == 0); | 4230 | WARN_ON(vma->pin_count == 0); |
4231 | WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view->type)); | 4231 | WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view)); |
4232 | 4232 | ||
4233 | if (--vma->pin_count == 0 && view->type == I915_GGTT_VIEW_NORMAL) | 4233 | if (--vma->pin_count == 0 && view->type == I915_GGTT_VIEW_NORMAL) |
4234 | obj->pin_mappable = false; | 4234 | obj->pin_mappable = false; |
@@ -4550,7 +4550,8 @@ struct i915_vma *i915_gem_obj_to_ggtt_view(struct drm_i915_gem_object *obj, | |||
4550 | return ERR_PTR(-EINVAL); | 4550 | return ERR_PTR(-EINVAL); |
4551 | 4551 | ||
4552 | list_for_each_entry(vma, &obj->vma_list, vma_link) | 4552 | list_for_each_entry(vma, &obj->vma_list, vma_link) |
4553 | if (vma->vm == ggtt && vma->ggtt_view.type == view->type) | 4553 | if (vma->vm == ggtt && |
4554 | i915_ggtt_view_equal(&vma->ggtt_view, view)) | ||
4554 | return vma; | 4555 | return vma; |
4555 | return NULL; | 4556 | return NULL; |
4556 | } | 4557 | } |
@@ -5107,13 +5108,14 @@ i915_gem_obj_offset(struct drm_i915_gem_object *o, | |||
5107 | 5108 | ||
5108 | unsigned long | 5109 | unsigned long |
5109 | i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o, | 5110 | i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o, |
5110 | enum i915_ggtt_view_type view) | 5111 | const struct i915_ggtt_view *view) |
5111 | { | 5112 | { |
5112 | struct i915_address_space *ggtt = i915_obj_to_ggtt(o); | 5113 | struct i915_address_space *ggtt = i915_obj_to_ggtt(o); |
5113 | struct i915_vma *vma; | 5114 | struct i915_vma *vma; |
5114 | 5115 | ||
5115 | list_for_each_entry(vma, &o->vma_list, vma_link) | 5116 | list_for_each_entry(vma, &o->vma_list, vma_link) |
5116 | if (vma->vm == ggtt && vma->ggtt_view.type == view) | 5117 | if (vma->vm == ggtt && |
5118 | i915_ggtt_view_equal(&vma->ggtt_view, view)) | ||
5117 | return vma->node.start; | 5119 | return vma->node.start; |
5118 | 5120 | ||
5119 | WARN(1, "global vma for this object not found.\n"); | 5121 | WARN(1, "global vma for this object not found.\n"); |
@@ -5137,14 +5139,14 @@ bool i915_gem_obj_bound(struct drm_i915_gem_object *o, | |||
5137 | } | 5139 | } |
5138 | 5140 | ||
5139 | bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, | 5141 | bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, |
5140 | enum i915_ggtt_view_type view) | 5142 | const struct i915_ggtt_view *view) |
5141 | { | 5143 | { |
5142 | struct i915_address_space *ggtt = i915_obj_to_ggtt(o); | 5144 | struct i915_address_space *ggtt = i915_obj_to_ggtt(o); |
5143 | struct i915_vma *vma; | 5145 | struct i915_vma *vma; |
5144 | 5146 | ||
5145 | list_for_each_entry(vma, &o->vma_list, vma_link) | 5147 | list_for_each_entry(vma, &o->vma_list, vma_link) |
5146 | if (vma->vm == ggtt && | 5148 | if (vma->vm == ggtt && |
5147 | vma->ggtt_view.type == view && | 5149 | i915_ggtt_view_equal(&vma->ggtt_view, view) && |
5148 | drm_mm_node_allocated(&vma->node)) | 5150 | drm_mm_node_allocated(&vma->node)) |
5149 | return true; | 5151 | return true; |
5150 | 5152 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index e82cec2c714e..0239fbff7bf7 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -93,6 +93,9 @@ | |||
93 | */ | 93 | */ |
94 | 94 | ||
95 | const struct i915_ggtt_view i915_ggtt_view_normal; | 95 | const struct i915_ggtt_view i915_ggtt_view_normal; |
96 | const struct i915_ggtt_view i915_ggtt_view_rotated = { | ||
97 | .type = I915_GGTT_VIEW_ROTATED | ||
98 | }; | ||
96 | 99 | ||
97 | static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv); | 100 | static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv); |
98 | static void chv_setup_private_ppat(struct drm_i915_private *dev_priv); | 101 | static void chv_setup_private_ppat(struct drm_i915_private *dev_priv); |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h index 3f0ad9f25441..fc03c99317c9 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.h +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h | |||
@@ -138,6 +138,7 @@ struct i915_ggtt_view { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | extern const struct i915_ggtt_view i915_ggtt_view_normal; | 140 | extern const struct i915_ggtt_view i915_ggtt_view_normal; |
141 | extern const struct i915_ggtt_view i915_ggtt_view_rotated; | ||
141 | 142 | ||
142 | enum i915_cache_level; | 143 | enum i915_cache_level; |
143 | 144 | ||
@@ -424,4 +425,14 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev); | |||
424 | int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj); | 425 | int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj); |
425 | void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj); | 426 | void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj); |
426 | 427 | ||
428 | static inline bool | ||
429 | i915_ggtt_view_equal(const struct i915_ggtt_view *a, | ||
430 | const struct i915_ggtt_view *b) | ||
431 | { | ||
432 | if (WARN_ON(!a || !b)) | ||
433 | return false; | ||
434 | |||
435 | return a->type == b->type; | ||
436 | } | ||
437 | |||
427 | #endif | 438 | #endif |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dc9a5c1d596c..3852cbaf9163 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2322,8 +2322,6 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, | |||
2322 | const struct drm_plane_state *plane_state) | 2322 | const struct drm_plane_state *plane_state) |
2323 | { | 2323 | { |
2324 | struct intel_rotation_info *info = &view->rotation_info; | 2324 | struct intel_rotation_info *info = &view->rotation_info; |
2325 | static const struct i915_ggtt_view rotated_view = | ||
2326 | { .type = I915_GGTT_VIEW_ROTATED }; | ||
2327 | 2325 | ||
2328 | *view = i915_ggtt_view_normal; | 2326 | *view = i915_ggtt_view_normal; |
2329 | 2327 | ||
@@ -2333,7 +2331,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, | |||
2333 | if (!intel_rotation_90_or_270(plane_state->rotation)) | 2331 | if (!intel_rotation_90_or_270(plane_state->rotation)) |
2334 | return 0; | 2332 | return 0; |
2335 | 2333 | ||
2336 | *view = rotated_view; | 2334 | *view = i915_ggtt_view_rotated; |
2337 | 2335 | ||
2338 | info->height = fb->height; | 2336 | info->height = fb->height; |
2339 | info->pixel_format = fb->pixel_format; | 2337 | info->pixel_format = fb->pixel_format; |
@@ -2930,10 +2928,10 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier, | |||
2930 | unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, | 2928 | unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, |
2931 | struct drm_i915_gem_object *obj) | 2929 | struct drm_i915_gem_object *obj) |
2932 | { | 2930 | { |
2933 | enum i915_ggtt_view_type view = I915_GGTT_VIEW_NORMAL; | 2931 | const struct i915_ggtt_view *view = &i915_ggtt_view_normal; |
2934 | 2932 | ||
2935 | if (intel_rotation_90_or_270(intel_plane->base.state->rotation)) | 2933 | if (intel_rotation_90_or_270(intel_plane->base.state->rotation)) |
2936 | view = I915_GGTT_VIEW_ROTATED; | 2934 | view = &i915_ggtt_view_rotated; |
2937 | 2935 | ||
2938 | return i915_gem_obj_ggtt_offset_view(obj, view); | 2936 | return i915_gem_obj_ggtt_offset_view(obj, view); |
2939 | } | 2937 | } |