compositor-drm: Track all plane types

Retain drm_plane tracking objects for all actual DRM planes when using
universal planes, not just overlay planes. Rename uses of 'sprite' to
'plane' to make it clear that it can now be any kind of plane, not just
an overlay/sprite.

These are currently unused.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Daniel Stone 10 years ago
parent c5de57f742
commit 085d2b9a01
  1. 72
      libweston/compositor-drm.c

@ -166,7 +166,7 @@ struct drm_backend {
int min_height, max_height; int min_height, max_height;
int no_addfb2; int no_addfb2;
struct wl_list sprite_list; struct wl_list plane_list;
int sprites_are_broken; int sprites_are_broken;
int sprites_hidden; int sprites_hidden;
@ -1129,7 +1129,7 @@ drm_output_repaint(struct weston_output *output_base,
struct drm_output *output = to_drm_output(output_base); struct drm_output *output = to_drm_output(output_base);
struct drm_backend *backend = struct drm_backend *backend =
to_drm_backend(output->base.compositor); to_drm_backend(output->base.compositor);
struct drm_plane *s; struct drm_plane *p;
struct drm_mode *mode; struct drm_mode *mode;
int ret = 0; int ret = 0;
@ -1191,28 +1191,29 @@ drm_output_repaint(struct weston_output *output_base,
/* /*
* Now, update all the sprite surfaces * Now, update all the sprite surfaces
*/ */
wl_list_for_each(s, &backend->sprite_list, link) { wl_list_for_each(p, &backend->plane_list, link) {
uint32_t flags = 0, fb_id = 0; uint32_t flags = 0, fb_id = 0;
drmVBlank vbl = { drmVBlank vbl = {
.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT, .request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
.request.sequence = 1, .request.sequence = 1,
}; };
/* XXX: Set output much earlier, so we don't attempt to place if (p->type != WDRM_PLANE_TYPE_OVERLAY)
* planes on entirely the wrong output. */ continue;
if ((!s->fb_current && !s->fb_pending) ||
!drm_plane_crtc_supported(output, s)) if ((!p->fb_current && !p->fb_pending) ||
!drm_plane_crtc_supported(output, p))
continue; continue;
if (s->fb_pending && !backend->sprites_hidden) if (p->fb_pending && !backend->sprites_hidden)
fb_id = s->fb_pending->fb_id; fb_id = p->fb_pending->fb_id;
ret = drmModeSetPlane(backend->drm.fd, s->plane_id, ret = drmModeSetPlane(backend->drm.fd, p->plane_id,
output->crtc_id, fb_id, flags, output->crtc_id, fb_id, flags,
s->dest_x, s->dest_y, p->dest_x, p->dest_y,
s->dest_w, s->dest_h, p->dest_w, p->dest_h,
s->src_x, s->src_y, p->src_x, p->src_y,
s->src_w, s->src_h); p->src_w, p->src_h);
if (ret) if (ret)
weston_log("setplane failed: %d: %s\n", weston_log("setplane failed: %d: %s\n",
ret, strerror(errno)); ret, strerror(errno));
@ -1223,17 +1224,17 @@ drm_output_repaint(struct weston_output *output_base,
* Queue a vblank signal so we know when the surface * Queue a vblank signal so we know when the surface
* becomes active on the display or has been replaced. * becomes active on the display or has been replaced.
*/ */
vbl.request.signal = (unsigned long)s; vbl.request.signal = (unsigned long) p;
ret = drmWaitVBlank(backend->drm.fd, &vbl); ret = drmWaitVBlank(backend->drm.fd, &vbl);
if (ret) { if (ret) {
weston_log("vblank event request failed: %d: %s\n", weston_log("vblank event request failed: %d: %s\n",
ret, strerror(errno)); ret, strerror(errno));
} }
s->output = output; p->output = output;
s->fb_last = s->fb_current; p->fb_last = p->fb_current;
s->fb_current = s->fb_pending; p->fb_current = p->fb_pending;
s->fb_pending = NULL; p->fb_pending = NULL;
output->vblank_pending++; output->vblank_pending++;
} }
@ -1489,7 +1490,10 @@ drm_output_prepare_overlay_view(struct drm_output *output,
if (ev->alpha != 1.0f) if (ev->alpha != 1.0f)
return NULL; return NULL;
wl_list_for_each(p, &b->sprite_list, link) { wl_list_for_each(p, &b->plane_list, link) {
if (p->type != WDRM_PLANE_TYPE_OVERLAY)
continue;
if (!drm_plane_crtc_supported(output, p)) if (!drm_plane_crtc_supported(output, p))
continue; continue;
@ -2171,7 +2175,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
drmModeFreeObjectProperties(props); drmModeFreeObjectProperties(props);
weston_plane_init(&plane->base, b->compositor, 0, 0); weston_plane_init(&plane->base, b->compositor, 0, 0);
wl_list_insert(&b->sprite_list, &plane->link); wl_list_insert(&b->plane_list, &plane->link);
return plane; return plane;
} }
@ -2232,13 +2236,9 @@ create_sprites(struct drm_backend *b)
if (!drm_plane) if (!drm_plane)
continue; continue;
/* Ignore non-overlay planes for now. */ if (drm_plane->type == WDRM_PLANE_TYPE_OVERLAY)
if (drm_plane->type != WDRM_PLANE_TYPE_OVERLAY) { weston_compositor_stack_plane(b->compositor,
drm_plane_destroy(drm_plane); &drm_plane->base,
continue;
}
weston_compositor_stack_plane(b->compositor, &drm_plane->base,
&b->compositor->primary_plane); &b->compositor->primary_plane);
} }
@ -2257,7 +2257,7 @@ destroy_sprites(struct drm_backend *b)
{ {
struct drm_plane *plane, *next; struct drm_plane *plane, *next;
wl_list_for_each_safe(plane, next, &b->sprite_list, link) wl_list_for_each_safe(plane, next, &b->plane_list, link)
drm_plane_destroy(plane); drm_plane_destroy(plane);
} }
@ -3490,7 +3490,7 @@ session_notify(struct wl_listener *listener, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
struct drm_backend *b = to_drm_backend(compositor); struct drm_backend *b = to_drm_backend(compositor);
struct drm_plane *sprite; struct drm_plane *plane;
struct drm_output *output; struct drm_output *output;
if (compositor->session_active) { if (compositor->session_active) {
@ -3524,12 +3524,16 @@ session_notify(struct wl_listener *listener, void *data)
output = container_of(compositor->output_list.next, output = container_of(compositor->output_list.next,
struct drm_output, base.link); struct drm_output, base.link);
wl_list_for_each(sprite, &b->sprite_list, link) wl_list_for_each(plane, &b->plane_list, link) {
if (plane->type != WDRM_PLANE_TYPE_OVERLAY)
continue;
drmModeSetPlane(b->drm.fd, drmModeSetPlane(b->drm.fd,
sprite->plane_id, plane->plane_id,
output->crtc_id, 0, 0, output->crtc_id, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0); 0, 0, 0, 0, 0, 0, 0, 0);
}; }
}
} }
/** /**
@ -3950,7 +3954,7 @@ drm_backend_create(struct weston_compositor *compositor,
weston_setup_vt_switch_bindings(compositor); weston_setup_vt_switch_bindings(compositor);
wl_list_init(&b->sprite_list); wl_list_init(&b->plane_list);
create_sprites(b); create_sprites(b);
if (udev_input_init(&b->input, if (udev_input_init(&b->input,

Loading…
Cancel
Save