summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2016-12-09 18:23:22 +0000
committerDaniel Stone <daniels@collabora.com>2017-02-07 19:16:34 +0000
commit4ecbe01f223a1c3e12b44e89887f248ef03ec0af (patch)
tree1f2c0af947e346c304995c4a083196b55a5c4f42
parent70d8424132558ae6b30bb15b7f8623bf970538fe (diff)
compositor-drm: Relax plane restrictions for atomic
Since we now incrementally test atomic state as we build it, we can loosen restrictions on what we can do with planes, and let the kernel tell us whether or not it's OK. Signed-off-by: Daniel Stone <daniels@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D1536
-rw-r--r--libweston/compositor-drm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 58d434ff..ff1c736e 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1668,6 +1668,7 @@ drm_output_prepare_scanout_view(struct drm_output_state *output_state,
enum drm_output_propose_state_mode mode)
{
struct drm_output *output = output_state->output;
+ struct drm_backend *b = to_drm_backend(output->base.compositor);
struct drm_plane *scanout_plane = output->scanout_plane;
struct drm_plane_state *state;
struct drm_plane_state *state_old = NULL;
@@ -1679,7 +1680,7 @@ drm_output_prepare_scanout_view(struct drm_output_state *output_state,
return NULL;
/* Can't change formats with just a pageflip */
- if (fb->format->format != output->gbm_format) {
+ if (!b->atomic_modeset && fb->format->format != output->gbm_format) {
drm_fb_unref(fb);
return NULL;
}
@@ -1704,15 +1705,18 @@ drm_output_prepare_scanout_view(struct drm_output_state *output_state,
state->output = output;
drm_plane_state_coords_for_view(state, ev);
- /* The legacy API does not let us perform cropping or scaling. */
- if (state->src_x != 0 || state->src_y != 0 ||
- state->src_w != state->dest_w << 16 ||
- state->src_h != state->dest_h << 16 ||
- state->dest_x != 0 || state->dest_y != 0 ||
+ if (state->dest_x != 0 || state->dest_y != 0 ||
state->dest_w != (unsigned) output->base.current_mode->width ||
state->dest_h != (unsigned) output->base.current_mode->height)
goto err;
+ /* The legacy API does not let us perform cropping or scaling. */
+ if (!b->atomic_modeset &&
+ (state->src_x != 0 || state->src_y != 0 ||
+ state->src_w != state->dest_w << 16 ||
+ state->src_h != state->dest_h << 16))
+ goto err;
+
if (mode == DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY)
return state;
@@ -2470,8 +2474,9 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
state->output = output;
drm_plane_state_coords_for_view(state, ev);
- if (state->src_w != state->dest_w << 16 ||
- state->src_h != state->dest_h << 16) {
+ if (!b->atomic_modeset &&
+ (state->src_w != state->dest_w << 16 ||
+ state->src_h != state->dest_h << 16)) {
drm_plane_state_put_back(state);
continue;
}