Lines Matching refs:plane_state

127 static unsigned int intel_fbc_plane_stride(const struct intel_plane_state *plane_state)  in intel_fbc_plane_stride()  argument
129 const struct drm_framebuffer *fb = plane_state->hw.fb; in intel_fbc_plane_stride()
132 stride = plane_state->view.color_plane[0].mapping_stride; in intel_fbc_plane_stride()
133 if (!drm_rotation_90_or_270(plane_state->hw.rotation)) in intel_fbc_plane_stride()
140 static unsigned int _intel_fbc_cfb_stride(const struct intel_plane_state *plane_state) in _intel_fbc_cfb_stride() argument
144 return intel_fbc_plane_stride(plane_state) * cpp; in _intel_fbc_cfb_stride()
148 static unsigned int skl_fbc_min_cfb_stride(const struct intel_plane_state *plane_state) in skl_fbc_min_cfb_stride() argument
150 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in skl_fbc_min_cfb_stride()
153 unsigned int width = drm_rect_width(&plane_state->uapi.src) >> 16; in skl_fbc_min_cfb_stride()
178 static unsigned int intel_fbc_cfb_stride(const struct intel_plane_state *plane_state) in intel_fbc_cfb_stride() argument
180 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_cfb_stride()
181 unsigned int stride = _intel_fbc_cfb_stride(plane_state); in intel_fbc_cfb_stride()
189 return max(ALIGN(stride, 512), skl_fbc_min_cfb_stride(plane_state)); in intel_fbc_cfb_stride()
194 static unsigned int intel_fbc_cfb_size(const struct intel_plane_state *plane_state) in intel_fbc_cfb_size() argument
196 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_cfb_size()
197 int lines = drm_rect_height(&plane_state->uapi.src) >> 16; in intel_fbc_cfb_size()
204 return lines * intel_fbc_cfb_stride(plane_state); in intel_fbc_cfb_size()
207 static u16 intel_fbc_override_cfb_stride(const struct intel_plane_state *plane_state) in intel_fbc_override_cfb_stride() argument
209 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_override_cfb_stride()
210 unsigned int stride_aligned = intel_fbc_cfb_stride(plane_state); in intel_fbc_override_cfb_stride()
211 unsigned int stride = _intel_fbc_cfb_stride(plane_state); in intel_fbc_override_cfb_stride()
212 const struct drm_framebuffer *fb = plane_state->hw.fb; in intel_fbc_override_cfb_stride()
739 static int intel_fbc_min_limit(const struct intel_plane_state *plane_state) in intel_fbc_min_limit() argument
741 return plane_state->hw.fb->format->cpp[0] == 2 ? 2 : 1; in intel_fbc_min_limit()
889 static bool i8xx_fbc_stride_is_valid(const struct intel_plane_state *plane_state) in i8xx_fbc_stride_is_valid() argument
891 const struct drm_framebuffer *fb = plane_state->hw.fb; in i8xx_fbc_stride_is_valid()
892 unsigned int stride = intel_fbc_plane_stride(plane_state) * in i8xx_fbc_stride_is_valid()
898 static bool i965_fbc_stride_is_valid(const struct intel_plane_state *plane_state) in i965_fbc_stride_is_valid() argument
900 const struct drm_framebuffer *fb = plane_state->hw.fb; in i965_fbc_stride_is_valid()
901 unsigned int stride = intel_fbc_plane_stride(plane_state) * in i965_fbc_stride_is_valid()
907 static bool g4x_fbc_stride_is_valid(const struct intel_plane_state *plane_state) in g4x_fbc_stride_is_valid() argument
912 static bool skl_fbc_stride_is_valid(const struct intel_plane_state *plane_state) in skl_fbc_stride_is_valid() argument
914 const struct drm_framebuffer *fb = plane_state->hw.fb; in skl_fbc_stride_is_valid()
915 unsigned int stride = intel_fbc_plane_stride(plane_state) * in skl_fbc_stride_is_valid()
925 static bool icl_fbc_stride_is_valid(const struct intel_plane_state *plane_state) in icl_fbc_stride_is_valid() argument
930 static bool stride_is_valid(const struct intel_plane_state *plane_state) in stride_is_valid() argument
932 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in stride_is_valid()
935 return icl_fbc_stride_is_valid(plane_state); in stride_is_valid()
937 return skl_fbc_stride_is_valid(plane_state); in stride_is_valid()
939 return g4x_fbc_stride_is_valid(plane_state); in stride_is_valid()
941 return i965_fbc_stride_is_valid(plane_state); in stride_is_valid()
943 return i8xx_fbc_stride_is_valid(plane_state); in stride_is_valid()
946 static bool i8xx_fbc_pixel_format_is_valid(const struct intel_plane_state *plane_state) in i8xx_fbc_pixel_format_is_valid() argument
948 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in i8xx_fbc_pixel_format_is_valid()
949 const struct drm_framebuffer *fb = plane_state->hw.fb; in i8xx_fbc_pixel_format_is_valid()
966 static bool g4x_fbc_pixel_format_is_valid(const struct intel_plane_state *plane_state) in g4x_fbc_pixel_format_is_valid() argument
968 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in g4x_fbc_pixel_format_is_valid()
969 const struct drm_framebuffer *fb = plane_state->hw.fb; in g4x_fbc_pixel_format_is_valid()
985 static bool lnl_fbc_pixel_format_is_valid(const struct intel_plane_state *plane_state) in lnl_fbc_pixel_format_is_valid() argument
987 const struct drm_framebuffer *fb = plane_state->hw.fb; in lnl_fbc_pixel_format_is_valid()
1001 static bool pixel_format_is_valid(const struct intel_plane_state *plane_state) in pixel_format_is_valid() argument
1003 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in pixel_format_is_valid()
1006 return lnl_fbc_pixel_format_is_valid(plane_state); in pixel_format_is_valid()
1008 return g4x_fbc_pixel_format_is_valid(plane_state); in pixel_format_is_valid()
1010 return i8xx_fbc_pixel_format_is_valid(plane_state); in pixel_format_is_valid()
1013 static bool i8xx_fbc_rotation_is_valid(const struct intel_plane_state *plane_state) in i8xx_fbc_rotation_is_valid() argument
1015 return plane_state->hw.rotation == DRM_MODE_ROTATE_0; in i8xx_fbc_rotation_is_valid()
1018 static bool g4x_fbc_rotation_is_valid(const struct intel_plane_state *plane_state) in g4x_fbc_rotation_is_valid() argument
1023 static bool skl_fbc_rotation_is_valid(const struct intel_plane_state *plane_state) in skl_fbc_rotation_is_valid() argument
1025 const struct drm_framebuffer *fb = plane_state->hw.fb; in skl_fbc_rotation_is_valid()
1026 unsigned int rotation = plane_state->hw.rotation; in skl_fbc_rotation_is_valid()
1035 static bool rotation_is_valid(const struct intel_plane_state *plane_state) in rotation_is_valid() argument
1037 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in rotation_is_valid()
1040 return skl_fbc_rotation_is_valid(plane_state); in rotation_is_valid()
1042 return g4x_fbc_rotation_is_valid(plane_state); in rotation_is_valid()
1044 return i8xx_fbc_rotation_is_valid(plane_state); in rotation_is_valid()
1053 static bool intel_fbc_hw_tracking_covers_screen(const struct intel_plane_state *plane_state) in intel_fbc_hw_tracking_covers_screen() argument
1055 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_hw_tracking_covers_screen()
1075 effective_w = plane_state->view.color_plane[0].x + in intel_fbc_hw_tracking_covers_screen()
1076 (drm_rect_width(&plane_state->uapi.src) >> 16); in intel_fbc_hw_tracking_covers_screen()
1077 effective_h = plane_state->view.color_plane[0].y + in intel_fbc_hw_tracking_covers_screen()
1078 (drm_rect_height(&plane_state->uapi.src) >> 16); in intel_fbc_hw_tracking_covers_screen()
1083 static bool intel_fbc_plane_size_valid(const struct intel_plane_state *plane_state) in intel_fbc_plane_size_valid() argument
1085 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_plane_size_valid()
1102 w = drm_rect_width(&plane_state->uapi.src) >> 16; in intel_fbc_plane_size_valid()
1103 h = drm_rect_height(&plane_state->uapi.src) >> 16; in intel_fbc_plane_size_valid()
1108 static bool i8xx_fbc_tiling_valid(const struct intel_plane_state *plane_state) in i8xx_fbc_tiling_valid() argument
1110 const struct drm_framebuffer *fb = plane_state->hw.fb; in i8xx_fbc_tiling_valid()
1115 static bool skl_fbc_tiling_valid(const struct intel_plane_state *plane_state) in skl_fbc_tiling_valid() argument
1120 static bool tiling_is_valid(const struct intel_plane_state *plane_state) in tiling_is_valid() argument
1122 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in tiling_is_valid()
1125 return skl_fbc_tiling_valid(plane_state); in tiling_is_valid()
1127 return i8xx_fbc_tiling_valid(plane_state); in tiling_is_valid()
1137 const struct intel_plane_state *plane_state = in intel_fbc_update_state() local
1142 WARN_ON(plane_state->no_fbc_reason); in intel_fbc_update_state()
1150 fbc_state->fence_y_offset = intel_plane_fence_y_offset(plane_state); in intel_fbc_update_state()
1152 drm_WARN_ON(&i915->drm, plane_state->flags & PLANE_HAS_FENCE && in intel_fbc_update_state()
1155 if (plane_state->flags & PLANE_HAS_FENCE) in intel_fbc_update_state()
1156 fbc_state->fence_id = i915_vma_fence_id(plane_state->ggtt_vma); in intel_fbc_update_state()
1160 fbc_state->cfb_stride = intel_fbc_cfb_stride(plane_state); in intel_fbc_update_state()
1161 fbc_state->cfb_size = intel_fbc_cfb_size(plane_state); in intel_fbc_update_state()
1162 fbc_state->override_cfb_stride = intel_fbc_override_cfb_stride(plane_state); in intel_fbc_update_state()
1165 static bool intel_fbc_is_fence_ok(const struct intel_plane_state *plane_state) in intel_fbc_is_fence_ok() argument
1167 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_is_fence_ok()
1182 (plane_state->flags & PLANE_HAS_FENCE && in intel_fbc_is_fence_ok()
1183 i915_vma_fence_id(plane_state->ggtt_vma) != -1); in intel_fbc_is_fence_ok()
1186 static bool intel_fbc_is_cfb_ok(const struct intel_plane_state *plane_state) in intel_fbc_is_cfb_ok() argument
1188 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); in intel_fbc_is_cfb_ok()
1191 return intel_fbc_min_limit(plane_state) <= fbc->limit && in intel_fbc_is_cfb_ok()
1192 intel_fbc_cfb_size(plane_state) <= fbc->limit * in intel_fbc_is_cfb_ok()
1196 static bool intel_fbc_is_ok(const struct intel_plane_state *plane_state) in intel_fbc_is_ok() argument
1198 return !plane_state->no_fbc_reason && in intel_fbc_is_ok()
1199 intel_fbc_is_fence_ok(plane_state) && in intel_fbc_is_ok()
1200 intel_fbc_is_cfb_ok(plane_state); in intel_fbc_is_ok()
1207 struct intel_plane_state *plane_state = in intel_fbc_check_plane() local
1209 const struct drm_framebuffer *fb = plane_state->hw.fb; in intel_fbc_check_plane()
1210 struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc); in intel_fbc_check_plane()
1218 plane_state->no_fbc_reason = "stolen memory not initialised"; in intel_fbc_check_plane()
1223 plane_state->no_fbc_reason = "VGPU active"; in intel_fbc_check_plane()
1228 plane_state->no_fbc_reason = "disabled per module param or by default"; in intel_fbc_check_plane()
1232 if (!plane_state->uapi.visible) { in intel_fbc_check_plane()
1233 plane_state->no_fbc_reason = "plane not visible"; in intel_fbc_check_plane()
1240 plane_state->no_fbc_reason = "interlaced mode not supported"; in intel_fbc_check_plane()
1245 plane_state->no_fbc_reason = "double wide pipe not supported"; in intel_fbc_check_plane()
1255 plane_state->no_fbc_reason = "PSR2 enabled"; in intel_fbc_check_plane()
1263 plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)"; in intel_fbc_check_plane()
1267 if (!pixel_format_is_valid(plane_state)) { in intel_fbc_check_plane()
1268 plane_state->no_fbc_reason = "pixel format not supported"; in intel_fbc_check_plane()
1272 if (!tiling_is_valid(plane_state)) { in intel_fbc_check_plane()
1273 plane_state->no_fbc_reason = "tiling not supported"; in intel_fbc_check_plane()
1277 if (!rotation_is_valid(plane_state)) { in intel_fbc_check_plane()
1278 plane_state->no_fbc_reason = "rotation not supported"; in intel_fbc_check_plane()
1282 if (!stride_is_valid(plane_state)) { in intel_fbc_check_plane()
1283 plane_state->no_fbc_reason = "stride not supported"; in intel_fbc_check_plane()
1288 plane_state->hw.pixel_blend_mode != DRM_MODE_BLEND_PIXEL_NONE && in intel_fbc_check_plane()
1290 plane_state->no_fbc_reason = "per-pixel alpha not supported"; in intel_fbc_check_plane()
1294 if (!intel_fbc_plane_size_valid(plane_state)) { in intel_fbc_check_plane()
1295 plane_state->no_fbc_reason = "plane size too big"; in intel_fbc_check_plane()
1299 if (!intel_fbc_hw_tracking_covers_screen(plane_state)) { in intel_fbc_check_plane()
1300 plane_state->no_fbc_reason = "surface size too big"; in intel_fbc_check_plane()
1310 plane_state->view.color_plane[0].y & 3) { in intel_fbc_check_plane()
1311 plane_state->no_fbc_reason = "plane start Y offset misaligned"; in intel_fbc_check_plane()
1317 (plane_state->view.color_plane[0].y + in intel_fbc_check_plane()
1318 (drm_rect_height(&plane_state->uapi.src) >> 16)) & 3) { in intel_fbc_check_plane()
1319 plane_state->no_fbc_reason = "plane end Y offset misaligned"; in intel_fbc_check_plane()
1332 plane_state->no_fbc_reason = "pixel rate too high"; in intel_fbc_check_plane()
1337 plane_state->no_fbc_reason = NULL; in intel_fbc_check_plane()
1428 const struct intel_plane_state __maybe_unused *plane_state; in intel_fbc_pre_update() local
1433 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_pre_update()
1481 const struct intel_plane_state __maybe_unused *plane_state; in intel_fbc_post_update() local
1485 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_post_update()
1580 struct intel_plane_state __maybe_unused *plane_state; in intel_fbc_atomic_check() local
1584 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_atomic_check()
1600 const struct intel_plane_state *plane_state = in __intel_fbc_enable() local
1610 if (intel_fbc_is_ok(plane_state)) { in __intel_fbc_enable()
1620 fbc->no_fbc_reason = plane_state->no_fbc_reason; in __intel_fbc_enable()
1624 if (!intel_fbc_is_fence_ok(plane_state)) { in __intel_fbc_enable()
1634 if (intel_fbc_alloc_cfb(fbc, intel_fbc_cfb_size(plane_state), in __intel_fbc_enable()
1635 intel_fbc_min_limit(plane_state))) { in __intel_fbc_enable()
1679 const struct intel_plane_state *plane_state; in intel_fbc_update() local
1683 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_update()
1692 plane_state->no_fbc_reason) { in intel_fbc_update()
1930 const struct intel_plane_state *plane_state = in intel_fbc_debugfs_status_show() local
1939 plane_state->no_fbc_reason ?: "FBC possible"); in intel_fbc_debugfs_status_show()