aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorJessica Zhang <quic_jesszhan@quicinc.com>2023-10-27 15:32:57 -0700
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-12-02 01:56:55 +0200
commitf1e75da5364e780905d9cd6043f9c74cdcf84073 (patch)
tree0cb8076f9f77e28ebb6692b7473bb909d7dc7070 /include/drm
parent4ba6b7a646321e740c7f2d80c90505019c4e8fce (diff)
downloadlinux-f1e75da5364e780905d9cd6043f9c74cdcf84073.tar.gz
drm/atomic: Loosen FB atomic checks
Loosen the requirements for atomic and legacy commit so that, in cases where pixel_source != FB, the commit can still go through. This includes adding framebuffer NULL checks in other areas to account for FB being NULL when non-FB pixel sources are enabled. To disable a plane, the pixel_source must be NONE or the FB must be NULL if pixel_source == FB. Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20231027-solid-fill-v7-7-780188bfa7b2@quicinc.com
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_atomic_helper.h4
-rw-r--r--include/drm/drm_plane.h29
2 files changed, 31 insertions, 2 deletions
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 536a0b0091c3a..6d97f38ac1f67 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -256,8 +256,8 @@ drm_atomic_plane_disabling(struct drm_plane_state *old_plane_state,
* Anything else should be considered a bug in the atomic core, so we
* gently warn about it.
*/
- WARN_ON((new_plane_state->crtc == NULL && new_plane_state->fb != NULL) ||
- (new_plane_state->crtc != NULL && new_plane_state->fb == NULL));
+ WARN_ON((new_plane_state->crtc == NULL && drm_plane_has_visible_data(new_plane_state)) ||
+ (new_plane_state->crtc != NULL && !drm_plane_has_visible_data(new_plane_state)));
return old_plane_state->crtc && !new_plane_state->crtc;
}
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index d14e2f1db2343..3b187f3f54664 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -1016,6 +1016,35 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
#define drm_for_each_plane(plane, dev) \
list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
+/**
+ * drm_plane_solid_fill_enabled - Check if solid fill is enabled on plane
+ * @state: plane state
+ *
+ * Returns:
+ * Whether the plane has been assigned a solid_fill_blob
+ */
+static inline bool drm_plane_solid_fill_enabled(struct drm_plane_state *state)
+{
+ if (!state)
+ return false;
+ return state->pixel_source == DRM_PLANE_PIXEL_SOURCE_SOLID_FILL && state->solid_fill_blob;
+}
+
+static inline bool drm_plane_has_visible_data(const struct drm_plane_state *state)
+{
+ switch (state->pixel_source) {
+ case DRM_PLANE_PIXEL_SOURCE_NONE:
+ return false;
+ case DRM_PLANE_PIXEL_SOURCE_SOLID_FILL:
+ return state->solid_fill_blob != NULL;
+ case DRM_PLANE_PIXEL_SOURCE_FB:
+ default:
+ WARN_ON(state->pixel_source != DRM_PLANE_PIXEL_SOURCE_FB);
+ }
+
+ return state->fb != NULL;
+}
+
bool drm_any_plane_has_format(struct drm_device *dev,
u32 format, u64 modifier);