backend-drm: Pass the plane to prepare_overlay_view

As we already have a potential plane available to use, pass it
over the _prepare_overlay_view instead of trying to find one
from the backend plane list.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
dev
Marius Vlad 5 years ago committed by Daniel Stone
parent 80a62e5873
commit 677e4598d9
  1. 36
      libweston/backend-drm/state-propose.c

@ -176,7 +176,8 @@ drm_output_plane_cursor_has_valid_format(struct weston_view *ev)
} }
static struct drm_plane_state * static struct drm_plane_state *
drm_output_prepare_overlay_view(struct drm_output_state *output_state, drm_output_prepare_overlay_view(struct drm_plane *plane,
struct drm_output_state *output_state,
struct weston_view *ev, struct weston_view *ev,
enum drm_output_propose_state_mode mode, enum drm_output_propose_state_mode mode,
uint64_t zpos) uint64_t zpos)
@ -184,7 +185,6 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
struct drm_output *output = output_state->output; struct drm_output *output = output_state->output;
struct weston_compositor *ec = output->base.compositor; struct weston_compositor *ec = output->base.compositor;
struct drm_backend *b = to_drm_backend(ec); struct drm_backend *b = to_drm_backend(ec);
struct drm_plane *p;
struct drm_plane_state *state = NULL; struct drm_plane_state *state = NULL;
struct drm_fb *fb; struct drm_fb *fb;
int ret; int ret;
@ -204,17 +204,10 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
return NULL; return NULL;
} }
wl_list_for_each(p, &b->plane_list, link) { state = drm_output_state_get_plane(output_state, plane);
if (p->type != WDRM_PLANE_TYPE_OVERLAY)
continue;
if (!drm_plane_is_available(p, output))
continue;
state = drm_output_state_get_plane(output_state, p);
if (state->fb) { if (state->fb) {
state = NULL; state = NULL;
continue; goto out;
} }
state->ev = ev; state->ev = ev;
@ -224,19 +217,19 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
"unsuitable transform\n", ev); "unsuitable transform\n", ev);
drm_plane_state_put_back(state); drm_plane_state_put_back(state);
state = NULL; state = NULL;
continue; goto out;
} }
/* If the surface buffer has an in-fence fd, but the plane /* If the surface buffer has an in-fence fd, but the plane
* doesn't support fences, we can't place the buffer on this * doesn't support fences, we can't place the buffer on this
* plane. */ * plane. */
if (ev->surface->acquire_fence_fd >= 0 && if (ev->surface->acquire_fence_fd >= 0 &&
p->props[WDRM_PLANE_IN_FENCE_FD].prop_id == 0) { plane->props[WDRM_PLANE_IN_FENCE_FD].prop_id == 0) {
drm_debug(b, "\t\t\t\t[overlay] not placing view %p on overlay: " drm_debug(b, "\t\t\t\t[overlay] not placing view %p on overlay: "
"no in-fence support\n", ev); "no in-fence support\n", ev);
drm_plane_state_put_back(state); drm_plane_state_put_back(state);
state = NULL; state = NULL;
continue; goto out;
} }
/* We hold one reference for the lifetime of this function; /* We hold one reference for the lifetime of this function;
@ -250,29 +243,28 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
/* In planes-only mode, we don't have an incremental state to /* In planes-only mode, we don't have an incremental state to
* test against, so we just hope it'll work. */ * test against, so we just hope it'll work. */
if (mode == DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) { if (mode == DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) {
drm_debug(b, "\t\t\t\t[overlay] provisionally placing " drm_debug(b, "\t\t\t[overlay] provisionally placing "
"view %p on overlay %lu in planes-only mode\n", "view %p on overlay %lu in planes-only mode\n",
ev, (unsigned long) p->plane_id); ev, (unsigned long) plane->plane_id);
availability = PLACED_ON_PLANE; availability = PLACED_ON_PLANE;
goto out; goto out;
} }
ret = drm_pending_state_test(output_state->pending_state); ret = drm_pending_state_test(output_state->pending_state);
if (ret == 0) { if (ret == 0) {
drm_debug(b, "\t\t\t\t[overlay] provisionally placing " drm_debug(b, "\t\t\t[overlay] provisionally placing "
"view %p on overlay %d in mixed mode\n", "view %p on overlay %d in mixed mode\n",
ev, p->plane_id); ev, plane->plane_id);
availability = PLACED_ON_PLANE; availability = PLACED_ON_PLANE;
goto out; goto out;
} }
drm_debug(b, "\t\t\t\t[overlay] not placing view %p on overlay %lu " drm_debug(b, "\t\t\t[overlay] not placing view %p on overlay %lu "
"in mixed mode: kernel test failed\n", "in mixed mode: kernel test failed\n",
ev, (unsigned long) p->plane_id); ev, (unsigned long) plane->plane_id);
drm_plane_state_put_back(state); drm_plane_state_put_back(state);
state = NULL; state = NULL;
}
switch (availability) { switch (availability) {
case NO_PLANES: case NO_PLANES:
@ -555,7 +547,7 @@ drm_output_try_view_on_plane(struct drm_plane *plane,
plane->plane_id, ev); plane->plane_id, ev);
return NULL; return NULL;
} }
return drm_output_prepare_overlay_view(state, ev, mode, zpos); return drm_output_prepare_overlay_view(plane, state, ev, mode, zpos);
case WDRM_PLANE_TYPE_PRIMARY: case WDRM_PLANE_TYPE_PRIMARY:
if (mode != DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) { if (mode != DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) {
drm_debug(b, "\t\t\t\t[plane] plane %d refusing to " drm_debug(b, "\t\t\t\t[plane] plane %d refusing to "

Loading…
Cancel
Save