summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2018-07-10 18:19:37 +0100
committerDaniel Stone <daniels@collabora.com>2018-07-11 13:08:57 +0100
commitd12e51646aae32a689af5785d0f81f58c8fa901c (patch)
tree9c36139238ce31f299f9c2df0e868b87f597db4c
parentca6fbe3c93ff05bf006e19ac8e60f896a169b5a1 (diff)
compositor-drm: Add planes-only mode to state proposal
Add a new mode, which attempts to construct a scene exclusively using planes. This is a building block for incrementally testing and constructing state: in the plane-only mode, we test the state exactly once, when we have constructed a full set of planes and want to know if it works or not. When using the renderer, we need to incrementally test views one by one to see if they will work on planes, falling back to the renderer if not. This test is different, since the scanout plane will be occupied by the renderer's buffer. Testing using the renderer or client buffers may have completely different characteristics, so we need two passes: first, constructing a state with only planes and testing if that succeeds, falling back later to a mixed renderer/plane mode which tests incrementally. This implements the first mode, and preferentially attempts to use it. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--libweston/compositor-drm.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index e629779f..486fb71d 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1944,6 +1944,7 @@ drm_output_assign_state(struct drm_output_state *state,
enum drm_output_propose_state_mode {
DRM_OUTPUT_PROPOSE_STATE_MIXED, /**< mix renderer & planes */
DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY, /**< only assign to renderer & cursor */
+ DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY, /**< no renderer use, only planes */
};
static struct drm_plane_state *
@@ -3318,6 +3319,7 @@ drm_output_propose_state(struct weston_output *output_base,
struct weston_view *ev;
pixman_region32_t surface_overlap, renderer_region, occluded_region;
bool planes_ok = (mode != DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY);
+ bool renderer_ok = (mode != DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY);
int ret;
assert(!output->state_last);
@@ -3431,6 +3433,14 @@ drm_output_propose_state(struct weston_output *output_base,
continue;
}
+ /* We have been assigned to the primary (renderer) plane:
+ * check if this is OK, and add ourselves to the renderer
+ * region if so. */
+ if (!renderer_ok) {
+ pixman_region32_fini(&clipped_view);
+ goto err_region;
+ }
+
pixman_region32_union(&renderer_region,
&renderer_region,
&clipped_view);
@@ -3446,6 +3456,9 @@ drm_output_propose_state(struct weston_output *output_base,
return state;
+err_region:
+ pixman_region32_fini(&renderer_region);
+ pixman_region32_fini(&occluded_region);
err:
drm_output_state_free(state);
return NULL;
@@ -3462,9 +3475,13 @@ drm_assign_planes(struct weston_output *output_base, void *repaint_data)
struct weston_view *ev;
struct weston_plane *primary = &output_base->compositor->primary_plane;
- if (!b->sprites_are_broken)
+ if (!b->sprites_are_broken) {
state = drm_output_propose_state(output_base, pending_state,
- DRM_OUTPUT_PROPOSE_STATE_MIXED);
+ DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY);
+ if (!state)
+ state = drm_output_propose_state(output_base, pending_state,
+ DRM_OUTPUT_PROPOSE_STATE_MIXED);
+ }
if (!state)
state = drm_output_propose_state(output_base, pending_state,