[PATCH weston 07/68] compositor-drm: Simplify drm_sprite_crtc_supported
Daniel Stone
daniels at collabora.com
Fri Dec 9 19:57:22 UTC 2016
No need to walk the CRTC list every time looking for CRTC indices, when we
already have the CRTC index stashed away. Taking the plane as an argument
also simplifies things a little for callers, and future-proofs for a
potential future KMS API which passes a list of supported CRTC IDs rather
than a bitmask of supported CRTC indices.
Signed-off-by: Daniel Stone <daniels at collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1407
---
libweston/compositor-drm.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index d577c05..2d5faa0 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -234,21 +234,9 @@ static void
drm_output_update_msc(struct drm_output *output, unsigned int seq);
static int
-drm_sprite_crtc_supported(struct drm_output *output, uint32_t supported)
+drm_sprite_crtc_supported(struct drm_output *output, struct drm_sprite *sprite)
{
- struct weston_compositor *ec = output->base.compositor;
- struct drm_backend *b = to_drm_backend(ec);
- int crtc;
-
- for (crtc = 0; crtc < b->num_crtcs; crtc++) {
- if (b->crtcs[crtc] != output->crtc_id)
- continue;
-
- if (supported & (1 << crtc))
- return -1;
- }
-
- return 0;
+ return !!(sprite->possible_crtcs & (1 << output->pipe));
}
static void
@@ -716,7 +704,7 @@ drm_output_repaint(struct weston_output *output_base,
};
if ((!s->current && !s->next) ||
- !drm_sprite_crtc_supported(output, s->possible_crtcs))
+ !drm_sprite_crtc_supported(output, s))
continue;
if (s->next && !backend->sprites_hidden)
@@ -991,7 +979,7 @@ drm_output_prepare_overlay_view(struct drm_output *output,
return NULL;
wl_list_for_each(s, &b->sprite_list, link) {
- if (!drm_sprite_crtc_supported(output, s->possible_crtcs))
+ if (!drm_sprite_crtc_supported(output, s))
continue;
if (!s->next) {
--
2.9.3
More information about the wayland-devel
mailing list