backend-drm: Make use of weston_buffer format and type

Just pull it from the structure rather than pulling it in externally.

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

@ -169,7 +169,6 @@ cursor_bo_update(struct drm_plane_state *plane_state, struct weston_view *ev)
int i; int i;
assert(buffer && buffer->shm_buffer); assert(buffer && buffer->shm_buffer);
assert(buffer->shm_buffer == wl_shm_buffer_get(buffer->resource));
assert(buffer->width <= b->cursor_width); assert(buffer->width <= b->cursor_width);
assert(buffer->height <= b->cursor_height); assert(buffer->height <= b->cursor_height);
@ -432,7 +431,6 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
struct weston_view *ev = pnode->view; struct weston_view *ev = pnode->view;
struct weston_buffer *buffer; struct weston_buffer *buffer;
struct wl_shm_buffer *shmbuf;
struct drm_fb *fb = NULL; struct drm_fb *fb = NULL;
bool view_matches_entire_output, scanout_has_view_assigned; bool view_matches_entire_output, scanout_has_view_assigned;
@ -448,15 +446,16 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
} }
buffer = ev->surface->buffer_ref.buffer; buffer = ev->surface->buffer_ref.buffer;
shmbuf = wl_shm_buffer_get(buffer->resource); if (buffer->type == WESTON_BUFFER_SHM) {
if (shmbuf) {
if (!output->cursor_plane || b->cursors_are_broken) { if (!output->cursor_plane || b->cursors_are_broken) {
pnode->try_view_on_plane_failure_reasons |= pnode->try_view_on_plane_failure_reasons |=
FAILURE_REASONS_FB_FORMAT_INCOMPATIBLE; FAILURE_REASONS_FB_FORMAT_INCOMPATIBLE;
return NULL; return NULL;
} }
if (wl_shm_buffer_get_format(shmbuf) != WL_SHM_FORMAT_ARGB8888) { /* Even though this is a SHM buffer, pixel_format stores the
* format code as DRM FourCC */
if (buffer->pixel_format->format != DRM_FORMAT_ARGB8888) {
drm_debug(b, "\t\t\t\t[view] not placing view %p on " drm_debug(b, "\t\t\t\t[view] not placing view %p on "
"plane; SHM buffers must be ARGB8888 for " "plane; SHM buffers must be ARGB8888 for "
"cursor view\n", ev); "cursor view\n", ev);
@ -512,7 +511,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
switch (plane->type) { switch (plane->type) {
case WDRM_PLANE_TYPE_CURSOR: case WDRM_PLANE_TYPE_CURSOR:
assert(shmbuf); assert(buffer->shm_buffer);
assert(plane == output->cursor_plane); assert(plane == output->cursor_plane);
break; break;
case WDRM_PLANE_TYPE_PRIMARY: case WDRM_PLANE_TYPE_PRIMARY:
@ -959,7 +958,7 @@ drm_assign_planes(struct weston_output *output_base)
*/ */
if (b->use_pixman || if (b->use_pixman ||
(weston_view_has_valid_buffer(ev) && (weston_view_has_valid_buffer(ev) &&
(!wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource) || (ev->surface->buffer_ref.buffer->type != WESTON_BUFFER_SHM ||
(ev->surface->width <= b->cursor_width && (ev->surface->width <= b->cursor_width &&
ev->surface->height <= b->cursor_height)))) ev->surface->height <= b->cursor_height))))
ev->surface->keep_buffer = true; ev->surface->keep_buffer = true;

Loading…
Cancel
Save