diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sprite.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sprite.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 9a17b4e92ef4..168c6652cda1 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -218,7 +218,8 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, | |||
218 | 218 | ||
219 | sprctl |= SP_ENABLE; | 219 | sprctl |= SP_ENABLE; |
220 | 220 | ||
221 | intel_update_sprite_watermarks(dplane, crtc, src_w, pixel_size, true, | 221 | intel_update_sprite_watermarks(dplane, crtc, src_w, src_h, |
222 | pixel_size, true, | ||
222 | src_w != crtc_w || src_h != crtc_h); | 223 | src_w != crtc_w || src_h != crtc_h); |
223 | 224 | ||
224 | /* Sizes are 0 based */ | 225 | /* Sizes are 0 based */ |
@@ -283,7 +284,7 @@ vlv_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) | |||
283 | if (atomic_update) | 284 | if (atomic_update) |
284 | intel_pipe_update_end(intel_crtc, start_vbl_count); | 285 | intel_pipe_update_end(intel_crtc, start_vbl_count); |
285 | 286 | ||
286 | intel_update_sprite_watermarks(dplane, crtc, 0, 0, false, false); | 287 | intel_update_sprite_watermarks(dplane, crtc, 0, 0, 0, false, false); |
287 | } | 288 | } |
288 | 289 | ||
289 | static int | 290 | static int |
@@ -406,7 +407,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
406 | if (IS_HASWELL(dev) || IS_BROADWELL(dev)) | 407 | if (IS_HASWELL(dev) || IS_BROADWELL(dev)) |
407 | sprctl |= SPRITE_PIPE_CSC_ENABLE; | 408 | sprctl |= SPRITE_PIPE_CSC_ENABLE; |
408 | 409 | ||
409 | intel_update_sprite_watermarks(plane, crtc, src_w, pixel_size, true, | 410 | intel_update_sprite_watermarks(plane, crtc, src_w, src_h, pixel_size, |
411 | true, | ||
410 | src_w != crtc_w || src_h != crtc_h); | 412 | src_w != crtc_w || src_h != crtc_h); |
411 | 413 | ||
412 | /* Sizes are 0 based */ | 414 | /* Sizes are 0 based */ |
@@ -486,7 +488,7 @@ ivb_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc) | |||
486 | */ | 488 | */ |
487 | intel_wait_for_vblank(dev, pipe); | 489 | intel_wait_for_vblank(dev, pipe); |
488 | 490 | ||
489 | intel_update_sprite_watermarks(plane, crtc, 0, 0, false, false); | 491 | intel_update_sprite_watermarks(plane, crtc, 0, 0, 0, false, false); |
490 | } | 492 | } |
491 | 493 | ||
492 | static int | 494 | static int |
@@ -606,7 +608,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
606 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */ | 608 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */ |
607 | dvscntr |= DVS_ENABLE; | 609 | dvscntr |= DVS_ENABLE; |
608 | 610 | ||
609 | intel_update_sprite_watermarks(plane, crtc, src_w, pixel_size, true, | 611 | intel_update_sprite_watermarks(plane, crtc, src_w, src_h, |
612 | pixel_size, true, | ||
610 | src_w != crtc_w || src_h != crtc_h); | 613 | src_w != crtc_w || src_h != crtc_h); |
611 | 614 | ||
612 | /* Sizes are 0 based */ | 615 | /* Sizes are 0 based */ |
@@ -681,7 +684,7 @@ ilk_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc) | |||
681 | */ | 684 | */ |
682 | intel_wait_for_vblank(dev, pipe); | 685 | intel_wait_for_vblank(dev, pipe); |
683 | 686 | ||
684 | intel_update_sprite_watermarks(plane, crtc, 0, 0, false, false); | 687 | intel_update_sprite_watermarks(plane, crtc, 0, 0, 0, false, false); |
685 | } | 688 | } |
686 | 689 | ||
687 | static void | 690 | static void |
@@ -819,6 +822,7 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
819 | struct drm_device *dev = plane->dev; | 822 | struct drm_device *dev = plane->dev; |
820 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 823 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
821 | struct intel_plane *intel_plane = to_intel_plane(plane); | 824 | struct intel_plane *intel_plane = to_intel_plane(plane); |
825 | enum pipe pipe = intel_crtc->pipe; | ||
822 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); | 826 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); |
823 | struct drm_i915_gem_object *obj = intel_fb->obj; | 827 | struct drm_i915_gem_object *obj = intel_fb->obj; |
824 | struct drm_i915_gem_object *old_obj = intel_plane->obj; | 828 | struct drm_i915_gem_object *old_obj = intel_plane->obj; |
@@ -1006,6 +1010,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
1006 | */ | 1010 | */ |
1007 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); | 1011 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); |
1008 | 1012 | ||
1013 | i915_gem_track_fb(old_obj, obj, | ||
1014 | INTEL_FRONTBUFFER_SPRITE(pipe)); | ||
1009 | mutex_unlock(&dev->struct_mutex); | 1015 | mutex_unlock(&dev->struct_mutex); |
1010 | 1016 | ||
1011 | if (ret) | 1017 | if (ret) |
@@ -1039,6 +1045,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
1039 | else | 1045 | else |
1040 | intel_plane->disable_plane(plane, crtc); | 1046 | intel_plane->disable_plane(plane, crtc); |
1041 | 1047 | ||
1048 | intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_SPRITE(pipe)); | ||
1049 | |||
1042 | if (!primary_was_enabled && primary_enabled) | 1050 | if (!primary_was_enabled && primary_enabled) |
1043 | intel_post_enable_primary(crtc); | 1051 | intel_post_enable_primary(crtc); |
1044 | } | 1052 | } |
@@ -1068,6 +1076,7 @@ intel_disable_plane(struct drm_plane *plane) | |||
1068 | struct drm_device *dev = plane->dev; | 1076 | struct drm_device *dev = plane->dev; |
1069 | struct intel_plane *intel_plane = to_intel_plane(plane); | 1077 | struct intel_plane *intel_plane = to_intel_plane(plane); |
1070 | struct intel_crtc *intel_crtc; | 1078 | struct intel_crtc *intel_crtc; |
1079 | enum pipe pipe; | ||
1071 | 1080 | ||
1072 | if (!plane->fb) | 1081 | if (!plane->fb) |
1073 | return 0; | 1082 | return 0; |
@@ -1076,6 +1085,7 @@ intel_disable_plane(struct drm_plane *plane) | |||
1076 | return -EINVAL; | 1085 | return -EINVAL; |
1077 | 1086 | ||
1078 | intel_crtc = to_intel_crtc(plane->crtc); | 1087 | intel_crtc = to_intel_crtc(plane->crtc); |
1088 | pipe = intel_crtc->pipe; | ||
1079 | 1089 | ||
1080 | if (intel_crtc->active) { | 1090 | if (intel_crtc->active) { |
1081 | bool primary_was_enabled = intel_crtc->primary_enabled; | 1091 | bool primary_was_enabled = intel_crtc->primary_enabled; |
@@ -1094,6 +1104,8 @@ intel_disable_plane(struct drm_plane *plane) | |||
1094 | 1104 | ||
1095 | mutex_lock(&dev->struct_mutex); | 1105 | mutex_lock(&dev->struct_mutex); |
1096 | intel_unpin_fb_obj(intel_plane->obj); | 1106 | intel_unpin_fb_obj(intel_plane->obj); |
1107 | i915_gem_track_fb(intel_plane->obj, NULL, | ||
1108 | INTEL_FRONTBUFFER_SPRITE(pipe)); | ||
1097 | mutex_unlock(&dev->struct_mutex); | 1109 | mutex_unlock(&dev->struct_mutex); |
1098 | 1110 | ||
1099 | intel_plane->obj = NULL; | 1111 | intel_plane->obj = NULL; |
@@ -1114,7 +1126,6 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data, | |||
1114 | struct drm_file *file_priv) | 1126 | struct drm_file *file_priv) |
1115 | { | 1127 | { |
1116 | struct drm_intel_sprite_colorkey *set = data; | 1128 | struct drm_intel_sprite_colorkey *set = data; |
1117 | struct drm_mode_object *obj; | ||
1118 | struct drm_plane *plane; | 1129 | struct drm_plane *plane; |
1119 | struct intel_plane *intel_plane; | 1130 | struct intel_plane *intel_plane; |
1120 | int ret = 0; | 1131 | int ret = 0; |
@@ -1128,13 +1139,12 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data, | |||
1128 | 1139 | ||
1129 | drm_modeset_lock_all(dev); | 1140 | drm_modeset_lock_all(dev); |
1130 | 1141 | ||
1131 | obj = drm_mode_object_find(dev, set->plane_id, DRM_MODE_OBJECT_PLANE); | 1142 | plane = drm_plane_find(dev, set->plane_id); |
1132 | if (!obj) { | 1143 | if (!plane) { |
1133 | ret = -ENOENT; | 1144 | ret = -ENOENT; |
1134 | goto out_unlock; | 1145 | goto out_unlock; |
1135 | } | 1146 | } |
1136 | 1147 | ||
1137 | plane = obj_to_plane(obj); | ||
1138 | intel_plane = to_intel_plane(plane); | 1148 | intel_plane = to_intel_plane(plane); |
1139 | ret = intel_plane->update_colorkey(plane, set); | 1149 | ret = intel_plane->update_colorkey(plane, set); |
1140 | 1150 | ||
@@ -1147,7 +1157,6 @@ int intel_sprite_get_colorkey(struct drm_device *dev, void *data, | |||
1147 | struct drm_file *file_priv) | 1157 | struct drm_file *file_priv) |
1148 | { | 1158 | { |
1149 | struct drm_intel_sprite_colorkey *get = data; | 1159 | struct drm_intel_sprite_colorkey *get = data; |
1150 | struct drm_mode_object *obj; | ||
1151 | struct drm_plane *plane; | 1160 | struct drm_plane *plane; |
1152 | struct intel_plane *intel_plane; | 1161 | struct intel_plane *intel_plane; |
1153 | int ret = 0; | 1162 | int ret = 0; |
@@ -1157,13 +1166,12 @@ int intel_sprite_get_colorkey(struct drm_device *dev, void *data, | |||
1157 | 1166 | ||
1158 | drm_modeset_lock_all(dev); | 1167 | drm_modeset_lock_all(dev); |
1159 | 1168 | ||
1160 | obj = drm_mode_object_find(dev, get->plane_id, DRM_MODE_OBJECT_PLANE); | 1169 | plane = drm_plane_find(dev, get->plane_id); |
1161 | if (!obj) { | 1170 | if (!plane) { |
1162 | ret = -ENOENT; | 1171 | ret = -ENOENT; |
1163 | goto out_unlock; | 1172 | goto out_unlock; |
1164 | } | 1173 | } |
1165 | 1174 | ||
1166 | plane = obj_to_plane(obj); | ||
1167 | intel_plane = to_intel_plane(plane); | 1175 | intel_plane = to_intel_plane(plane); |
1168 | intel_plane->get_colorkey(plane, get); | 1176 | intel_plane->get_colorkey(plane, get); |
1169 | 1177 | ||