drm-backend: Refactor unpleasant keep_buffer if tree

Break a giant if statement out into a more legible grouping.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent 2dcfe723be
commit 231a67ff8c
  1. 22
      libweston/backend-drm/state-propose.c

@ -956,14 +956,20 @@ drm_assign_planes(struct weston_output *output_base)
* renderer and since the pixman renderer keeps a reference * renderer and since the pixman renderer keeps a reference
* to the buffer anyway, there is no side effects. * to the buffer anyway, there is no side effects.
*/ */
if (b->use_pixman || ev->surface->keep_buffer = false;
(weston_view_has_valid_buffer(ev) && if (weston_view_has_valid_buffer(ev)) {
(ev->surface->buffer_ref.buffer->type != WESTON_BUFFER_SHM || struct weston_buffer *buffer =
(ev->surface->width <= b->cursor_width && ev->surface->buffer_ref.buffer;
ev->surface->height <= b->cursor_height)))) if (b->use_pixman)
ev->surface->keep_buffer = true; ev->surface->keep_buffer = true;
else else if (buffer->type == WESTON_BUFFER_DMABUF ||
ev->surface->keep_buffer = false; buffer->type == WESTON_BUFFER_RENDERER_OPAQUE)
ev->surface->keep_buffer = true;
else if (buffer->type == WESTON_BUFFER_SHM &&
(ev->surface->width <= b->cursor_width &&
ev->surface->height <= b->cursor_height))
ev->surface->keep_buffer = true;
}
/* This is a bit unpleasant, but lacking a temporary place to /* This is a bit unpleasant, but lacking a temporary place to
* hang a plane off the view, we have to do a nested walk. * hang a plane off the view, we have to do a nested walk.

Loading…
Cancel
Save