libweston: Add a new helper to check if the view spawns the entire
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 11 Sep 2019 13:53:08 +0000 (16:53 +0300)
committerDaniel Stone <daniels@collabora.com>
Mon, 11 Nov 2019 16:51:48 +0000 (16:51 +0000)
output

Helpful to determine if the view can go through the scanout or not.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
libweston/backend-drm/state-propose.c
libweston/compositor.c
libweston/libweston-internal.h

index 148397e9e0ff4e8e43aa95fcb7b6fa7c3c719787..cb5bffc2ee5b4c08ac6c7632f0a607e4b2d98d0d 100644 (file)
@@ -381,7 +381,6 @@ drm_output_prepare_scanout_view(struct drm_output_state *output_state,
        struct drm_plane *scanout_plane = output->scanout_plane;
        struct drm_plane_state *state;
        struct drm_fb *fb;
-       pixman_box32_t *extents;
 
        assert(!b->sprites_are_broken);
        assert(b->atomic_modeset);
@@ -389,11 +388,7 @@ drm_output_prepare_scanout_view(struct drm_output_state *output_state,
 
        /* Check the view spans exactly the output size, calculated in the
         * logical co-ordinate space. */
-       extents = pixman_region32_extents(&ev->transform.boundingbox);
-       if (extents->x1 != output->base.x ||
-           extents->y1 != output->base.y ||
-           extents->x2 != output->base.x + output->base.width ||
-           extents->y2 != output->base.y + output->base.height)
+       if (!weston_view_matches_output_entirely(ev, &output->base))
                return NULL;
 
        /* If the surface buffer has an in-fence fd, but the plane doesn't
index 794253f672ac51a0eaa289022cc575412a0f9a38..55f43af4fa218db7a5021517c1ddd9d25a6e8a72 100644 (file)
@@ -1864,6 +1864,29 @@ weston_view_has_valid_buffer(struct weston_view *ev)
        return ev->surface->buffer_ref.buffer != NULL;
 }
 
+/** Check if the view matches the entire output
+ *
+ * @param ev The view to check.
+ * @param output The output to check against.
+ *
+ * Returns true if the view does indeed matches the entire output.
+ */
+WL_EXPORT bool
+weston_view_matches_output_entirely(struct weston_view *ev,
+                                   struct weston_output *output)
+{
+       pixman_box32_t *extents =
+               pixman_region32_extents(&ev->transform.boundingbox);
+
+       if (extents->x1 != output->x ||
+           extents->y1 != output->y ||
+           extents->x2 != output->x + output->width ||
+           extents->y2 != output->y + output->height)
+               return false;
+
+       return true;
+}
+
 /* Check if a surface has a view assigned to it
  *
  * The indicator is set manually when mapping
index 4c8e35bdd28b29109b96a2615c42cbb76d167e6b..2099f3bce8d8af55ba6c34f10791c66449c7b584 100644 (file)
@@ -290,6 +290,9 @@ weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
 bool
 weston_view_has_valid_buffer(struct weston_view *ev);
 
+bool
+weston_view_matches_output_entirely(struct weston_view *ev,
+                                   struct weston_output *output);
 void
 weston_view_move_to_plane(struct weston_view *view,
                          struct weston_plane *plane);