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>
This commit is contained in:
parent
ca6fbe3c93
commit
d12e51646a
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user