Commit 90648879 authored by Daniel Stone's avatar Daniel Stone

compositor-drm: Make scanout view preparation more stringent

Don't import buffers which span multiple outputs, short-cut any attempt
to import SHM buffers, and ignore buffers with a global alpha set.

I'm not convinced all of these conditions entirely make sense, but this
at least makes them equally nonsensical.

Differential Revision: https://phabricator.freedesktop.org/D1414Signed-off-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
Reviewed-by: default avatarDerek Foreman <derekf@osg.samsung.com>
parent 445b41b9
......@@ -499,6 +499,13 @@ drm_output_release_fb(struct drm_output *output, struct drm_fb *fb)
}
}
static int
drm_view_transform_supported(struct weston_view *ev)
{
return !ev->transform.enabled ||
(ev->transform.matrix.type < WESTON_MATRIX_TRANSFORM_ROTATE);
}
static uint32_t
drm_output_check_scanout_format(struct drm_output *output,
struct weston_surface *es, struct gbm_bo *bo)
......@@ -539,27 +546,40 @@ drm_output_prepare_scanout_view(struct drm_output *output,
struct gbm_bo *bo;
uint32_t format;
/* Don't import buffers which span multiple outputs. */
if (ev->output_mask != (1u << output->base.id))
return NULL;
/* We use GBM to import buffers. */
if (b->gbm == NULL)
return NULL;
if (buffer == NULL)
return NULL;
if (wl_shm_buffer_get(buffer->resource))
return NULL;
/* Make sure our view is exactly compatible with the output. */
if (ev->geometry.x != output->base.x ||
ev->geometry.y != output->base.y)
return NULL;
if (buffer->width != output->base.current_mode->width ||
buffer->height != output->base.current_mode->height)
return NULL;
if (ev->transform.enabled)
return NULL;
if (ev->geometry.scissor_enabled)
return NULL;
if (buffer->width != output->base.current_mode->width ||
buffer->height != output->base.current_mode->height)
return NULL;
if (viewport->buffer.transform != output->base.transform)
return NULL;
if (viewport->buffer.scale != output->base.current_scale)
return NULL;
if (!drm_view_transform_supported(ev))
return NULL;
if (ev->alpha != 1.0f)
return NULL;
bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER,
buffer->resource, GBM_BO_USE_SCANOUT);
......@@ -973,13 +993,6 @@ drm_output_check_sprite_format(struct drm_sprite *s,
return 0;
}
static int
drm_view_transform_supported(struct weston_view *ev)
{
return !ev->transform.enabled ||
(ev->transform.matrix.type < WESTON_MATRIX_TRANSFORM_ROTATE);
}
static struct weston_plane *
drm_output_prepare_overlay_view(struct drm_output *output,
struct weston_view *ev)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment