]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Revert "drm/atomic: Loosen FB atomic checks"
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 4 Dec 2023 13:13:48 +0000 (15:13 +0200)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 4 Dec 2023 19:33:05 +0000 (21:33 +0200)
This reverts commit f1e75da5364e780905d9cd6043f9c74cdcf84073.

Although the Solid Fill planes patchset got all reviews and
acknowledgements, it doesn't fulfill requirements for the new uABI. It
has neither corresponding open-source userspace implementation nor the
IGT tests coverage. Reverting this patchset until userspace obligations
are fulfilled.

Acked-by: Simon Ser <contact@emersion.fr>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231204131455.19023-2-dmitry.baryshkov@linaro.org
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
include/drm/drm_atomic_helper.h
include/drm/drm_plane.h

index aed0a694c74c4084d0d277db8b14828448fd56ef..c6f2b86c48ae2c56c6e7718749ac3335da0eedd0 100644 (file)
@@ -674,16 +674,17 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 {
        struct drm_plane *plane = new_plane_state->plane;
        struct drm_crtc *crtc = new_plane_state->crtc;
+       const struct drm_framebuffer *fb = new_plane_state->fb;
        int ret;
 
-       /* either *both* CRTC and pixel source must be set, or neither */
-       if (crtc && !drm_plane_has_visible_data(new_plane_state)) {
-               drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no visible data\n",
+       /* either *both* CRTC and FB must be set, or neither */
+       if (crtc && !fb) {
+               drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no FB\n",
                               plane->base.id, plane->name);
                return -EINVAL;
-       } else if (drm_plane_has_visible_data(new_plane_state) && !crtc) {
-               drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] Source %d has visible data but no CRTC\n",
-                              plane->base.id, plane->name, new_plane_state->pixel_source);
+       } else if (fb && !crtc) {
+               drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] FB set but no CRTC\n",
+                              plane->base.id, plane->name);
                return -EINVAL;
        }
 
@@ -714,11 +715,9 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
        }
 
 
-       if (new_plane_state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && new_plane_state->fb) {
-               ret = drm_atomic_plane_check_fb(new_plane_state);
-               if (ret)
-                       return ret;
-       }
+       ret = drm_atomic_plane_check_fb(new_plane_state);
+       if (ret)
+               return ret;
 
        if (plane_switching_crtc(old_plane_state, new_plane_state)) {
                drm_dbg_atomic(plane->dev,
index dc048988e3f3c82aee51050cc8b821d27b440f33..c3f677130def0bee9843c5e359f74e176f1f1dbf 100644 (file)
@@ -861,6 +861,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
                                        bool can_position,
                                        bool can_update_disabled)
 {
+       struct drm_framebuffer *fb = plane_state->fb;
        struct drm_rect *src = &plane_state->src;
        struct drm_rect *dst = &plane_state->dst;
        unsigned int rotation = plane_state->rotation;
@@ -872,7 +873,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
        *src = drm_plane_state_src(plane_state);
        *dst = drm_plane_state_dest(plane_state);
 
-       if (!drm_plane_has_visible_data(plane_state)) {
+       if (!fb) {
                plane_state->visible = false;
                return 0;
        }
@@ -889,31 +890,25 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
                return -EINVAL;
        }
 
-       /* Check that selected pixel source is valid */
-       if (plane_state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && plane_state->fb) {
-               struct drm_framebuffer *fb = plane_state->fb;
-               drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
+       drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
 
-               /* Check scaling */
-               hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
-               vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
+       /* Check scaling */
+       hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
+       vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
+       if (hscale < 0 || vscale < 0) {
+               drm_dbg_kms(plane_state->plane->dev,
+                           "Invalid scaling of plane\n");
+               drm_rect_debug_print("src: ", &plane_state->src, true);
+               drm_rect_debug_print("dst: ", &plane_state->dst, false);
+               return -ERANGE;
+       }
 
-               if (hscale < 0 || vscale < 0) {
-                       drm_dbg_kms(plane_state->plane->dev,
-                                       "Invalid scaling of plane\n");
-                       drm_rect_debug_print("src: ", &plane_state->src, true);
-                       drm_rect_debug_print("dst: ", &plane_state->dst, false);
-                       return -ERANGE;
-               }
+       if (crtc_state->enable)
+               drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
 
-               if (crtc_state->enable)
-                       drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
+       plane_state->visible = drm_rect_clip_scaled(src, dst, &clip);
 
-               plane_state->visible = drm_rect_clip_scaled(src, dst, &clip);
-               drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
-       } else if (drm_plane_solid_fill_enabled(plane_state)) {
-               plane_state->visible = true;
-       }
+       drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
 
        if (!plane_state->visible)
                /*
index 6d97f38ac1f67633e7abbc31fd5702c55d94cedf..536a0b0091c3a9cf85c4007eac613191c114f75f 100644 (file)
@@ -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 && drm_plane_has_visible_data(new_plane_state)) ||
-               (new_plane_state->crtc != NULL && !drm_plane_has_visible_data(new_plane_state)));
+       WARN_ON((new_plane_state->crtc == NULL && new_plane_state->fb != NULL) ||
+               (new_plane_state->crtc != NULL && new_plane_state->fb == NULL));
 
        return old_plane_state->crtc && !new_plane_state->crtc;
 }
index 3b187f3f546643b7c42a5304e6a6fecb7e24ba15..d14e2f1db2343f09495655e66d4ab8f4cea41df8 100644 (file)
@@ -1016,35 +1016,6 @@ 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);