Lines Matching refs:plane_state
125 static unsigned int intel_fbc_plane_stride(const struct intel_plane_state *plane_state) in intel_fbc_plane_stride() argument
127 const struct drm_framebuffer *fb = plane_state->hw.fb; in intel_fbc_plane_stride()
130 stride = plane_state->view.color_plane[0].mapping_stride; in intel_fbc_plane_stride()
131 if (!drm_rotation_90_or_270(plane_state->hw.rotation)) in intel_fbc_plane_stride()
138 static unsigned int _intel_fbc_cfb_stride(const struct intel_plane_state *plane_state) in _intel_fbc_cfb_stride() argument
142 return intel_fbc_plane_stride(plane_state) * cpp; in _intel_fbc_cfb_stride()
146 static unsigned int skl_fbc_min_cfb_stride(const struct intel_plane_state *plane_state) in skl_fbc_min_cfb_stride() argument
148 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in skl_fbc_min_cfb_stride()
151 unsigned int width = drm_rect_width(&plane_state->uapi.src) >> 16; in skl_fbc_min_cfb_stride()
176 static unsigned int intel_fbc_cfb_stride(const struct intel_plane_state *plane_state) in intel_fbc_cfb_stride() argument
178 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_cfb_stride()
179 unsigned int stride = _intel_fbc_cfb_stride(plane_state); in intel_fbc_cfb_stride()
187 return max(ALIGN(stride, 512), skl_fbc_min_cfb_stride(plane_state)); in intel_fbc_cfb_stride()
192 static unsigned int intel_fbc_cfb_size(const struct intel_plane_state *plane_state) in intel_fbc_cfb_size() argument
194 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_cfb_size()
195 int lines = drm_rect_height(&plane_state->uapi.src) >> 16; in intel_fbc_cfb_size()
202 return lines * intel_fbc_cfb_stride(plane_state); in intel_fbc_cfb_size()
205 static u16 intel_fbc_override_cfb_stride(const struct intel_plane_state *plane_state) in intel_fbc_override_cfb_stride() argument
207 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_override_cfb_stride()
208 unsigned int stride_aligned = intel_fbc_cfb_stride(plane_state); in intel_fbc_override_cfb_stride()
209 unsigned int stride = _intel_fbc_cfb_stride(plane_state); in intel_fbc_override_cfb_stride()
210 const struct drm_framebuffer *fb = plane_state->hw.fb; in intel_fbc_override_cfb_stride()
726 static int intel_fbc_min_limit(const struct intel_plane_state *plane_state) in intel_fbc_min_limit() argument
728 return plane_state->hw.fb->format->cpp[0] == 2 ? 2 : 1; in intel_fbc_min_limit()
850 static bool stride_is_valid(const struct intel_plane_state *plane_state) in stride_is_valid() argument
852 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in stride_is_valid()
853 const struct drm_framebuffer *fb = plane_state->hw.fb; in stride_is_valid()
854 unsigned int stride = intel_fbc_plane_stride(plane_state) * in stride_is_valid()
882 static bool pixel_format_is_valid(const struct intel_plane_state *plane_state) in pixel_format_is_valid() argument
884 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in pixel_format_is_valid()
885 const struct drm_framebuffer *fb = plane_state->hw.fb; in pixel_format_is_valid()
905 static bool rotation_is_valid(const struct intel_plane_state *plane_state) in rotation_is_valid() argument
907 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in rotation_is_valid()
908 const struct drm_framebuffer *fb = plane_state->hw.fb; in rotation_is_valid()
909 unsigned int rotation = plane_state->hw.rotation; in rotation_is_valid()
927 static bool intel_fbc_hw_tracking_covers_screen(const struct intel_plane_state *plane_state) in intel_fbc_hw_tracking_covers_screen() argument
929 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_hw_tracking_covers_screen()
946 effective_w = plane_state->view.color_plane[0].x + in intel_fbc_hw_tracking_covers_screen()
947 (drm_rect_width(&plane_state->uapi.src) >> 16); in intel_fbc_hw_tracking_covers_screen()
948 effective_h = plane_state->view.color_plane[0].y + in intel_fbc_hw_tracking_covers_screen()
949 (drm_rect_height(&plane_state->uapi.src) >> 16); in intel_fbc_hw_tracking_covers_screen()
954 static bool tiling_is_valid(const struct intel_plane_state *plane_state) in tiling_is_valid() argument
956 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in tiling_is_valid()
957 const struct drm_framebuffer *fb = plane_state->hw.fb; in tiling_is_valid()
979 const struct intel_plane_state *plane_state = in intel_fbc_update_state() local
984 WARN_ON(plane_state->no_fbc_reason); in intel_fbc_update_state()
992 fbc_state->fence_y_offset = intel_plane_fence_y_offset(plane_state); in intel_fbc_update_state()
994 drm_WARN_ON(&i915->drm, plane_state->flags & PLANE_HAS_FENCE && in intel_fbc_update_state()
997 if (plane_state->flags & PLANE_HAS_FENCE) in intel_fbc_update_state()
998 fbc_state->fence_id = i915_vma_fence_id(plane_state->ggtt_vma); in intel_fbc_update_state()
1002 fbc_state->cfb_stride = intel_fbc_cfb_stride(plane_state); in intel_fbc_update_state()
1003 fbc_state->cfb_size = intel_fbc_cfb_size(plane_state); in intel_fbc_update_state()
1004 fbc_state->override_cfb_stride = intel_fbc_override_cfb_stride(plane_state); in intel_fbc_update_state()
1007 static bool intel_fbc_is_fence_ok(const struct intel_plane_state *plane_state) in intel_fbc_is_fence_ok() argument
1009 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); in intel_fbc_is_fence_ok()
1024 (plane_state->flags & PLANE_HAS_FENCE && in intel_fbc_is_fence_ok()
1025 i915_vma_fence_id(plane_state->ggtt_vma) != -1); in intel_fbc_is_fence_ok()
1028 static bool intel_fbc_is_cfb_ok(const struct intel_plane_state *plane_state) in intel_fbc_is_cfb_ok() argument
1030 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); in intel_fbc_is_cfb_ok()
1033 return intel_fbc_min_limit(plane_state) <= fbc->limit && in intel_fbc_is_cfb_ok()
1034 intel_fbc_cfb_size(plane_state) <= fbc->limit * in intel_fbc_is_cfb_ok()
1038 static bool intel_fbc_is_ok(const struct intel_plane_state *plane_state) in intel_fbc_is_ok() argument
1040 return !plane_state->no_fbc_reason && in intel_fbc_is_ok()
1041 intel_fbc_is_fence_ok(plane_state) && in intel_fbc_is_ok()
1042 intel_fbc_is_cfb_ok(plane_state); in intel_fbc_is_ok()
1049 struct intel_plane_state *plane_state = in intel_fbc_check_plane() local
1051 const struct drm_framebuffer *fb = plane_state->hw.fb; in intel_fbc_check_plane()
1052 struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc); in intel_fbc_check_plane()
1060 plane_state->no_fbc_reason = "stolen memory not initialised"; in intel_fbc_check_plane()
1065 plane_state->no_fbc_reason = "VGPU active"; in intel_fbc_check_plane()
1070 plane_state->no_fbc_reason = "disabled per module param or by default"; in intel_fbc_check_plane()
1074 if (!plane_state->uapi.visible) { in intel_fbc_check_plane()
1075 plane_state->no_fbc_reason = "plane not visible"; in intel_fbc_check_plane()
1082 plane_state->no_fbc_reason = "interlaced mode not supported"; in intel_fbc_check_plane()
1087 plane_state->no_fbc_reason = "double wide pipe not supported"; in intel_fbc_check_plane()
1097 plane_state->no_fbc_reason = "PSR2 enabled"; in intel_fbc_check_plane()
1105 plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)"; in intel_fbc_check_plane()
1109 if (!pixel_format_is_valid(plane_state)) { in intel_fbc_check_plane()
1110 plane_state->no_fbc_reason = "pixel format not supported"; in intel_fbc_check_plane()
1114 if (!tiling_is_valid(plane_state)) { in intel_fbc_check_plane()
1115 plane_state->no_fbc_reason = "tiling not supported"; in intel_fbc_check_plane()
1119 if (!rotation_is_valid(plane_state)) { in intel_fbc_check_plane()
1120 plane_state->no_fbc_reason = "rotation not supported"; in intel_fbc_check_plane()
1124 if (!stride_is_valid(plane_state)) { in intel_fbc_check_plane()
1125 plane_state->no_fbc_reason = "stride not supported"; in intel_fbc_check_plane()
1129 if (plane_state->hw.pixel_blend_mode != DRM_MODE_BLEND_PIXEL_NONE && in intel_fbc_check_plane()
1131 plane_state->no_fbc_reason = "per-pixel alpha not supported"; in intel_fbc_check_plane()
1135 if (!intel_fbc_hw_tracking_covers_screen(plane_state)) { in intel_fbc_check_plane()
1136 plane_state->no_fbc_reason = "plane size too big"; in intel_fbc_check_plane()
1146 plane_state->view.color_plane[0].y & 3) { in intel_fbc_check_plane()
1147 plane_state->no_fbc_reason = "plane start Y offset misaligned"; in intel_fbc_check_plane()
1153 (plane_state->view.color_plane[0].y + in intel_fbc_check_plane()
1154 (drm_rect_height(&plane_state->uapi.src) >> 16)) & 3) { in intel_fbc_check_plane()
1155 plane_state->no_fbc_reason = "plane end Y offset misaligned"; in intel_fbc_check_plane()
1168 plane_state->no_fbc_reason = "pixel rate too high"; in intel_fbc_check_plane()
1173 plane_state->no_fbc_reason = NULL; in intel_fbc_check_plane()
1264 const struct intel_plane_state __maybe_unused *plane_state; in intel_fbc_pre_update() local
1269 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_pre_update()
1319 const struct intel_plane_state __maybe_unused *plane_state; in intel_fbc_post_update() local
1323 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_post_update()
1418 struct intel_plane_state __maybe_unused *plane_state; in intel_fbc_atomic_check() local
1422 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_atomic_check()
1438 const struct intel_plane_state *plane_state = in __intel_fbc_enable() local
1448 if (intel_fbc_is_ok(plane_state)) { in __intel_fbc_enable()
1458 fbc->no_fbc_reason = plane_state->no_fbc_reason; in __intel_fbc_enable()
1462 if (!intel_fbc_is_fence_ok(plane_state)) { in __intel_fbc_enable()
1472 if (intel_fbc_alloc_cfb(fbc, intel_fbc_cfb_size(plane_state), in __intel_fbc_enable()
1473 intel_fbc_min_limit(plane_state))) { in __intel_fbc_enable()
1517 const struct intel_plane_state *plane_state; in intel_fbc_update() local
1521 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { in intel_fbc_update()
1530 plane_state->no_fbc_reason) { in intel_fbc_update()
1768 const struct intel_plane_state *plane_state = in intel_fbc_debugfs_status_show() local
1777 plane_state->no_fbc_reason ?: "FBC possible"); in intel_fbc_debugfs_status_show()