backend-drm: move check that skips cursor planes for views that don't use wl_shm buffer
In drm_output_prepare_plane_view() we iterate the list of planes and add them as candidates to promote the view to one of them. Cursor planes do not support buffers other than wl_shm (at least for now). So when we have a dmabuf or an EGL buffer in the view, the function drm_output_plane_cursor_has_valid_format() returns false and the cursor plane is not added to the candidate list. In this patch we move the responsibility of doing this from drm_output_plane_cursor_has_valid_format() to drm_output_prepare_plane_view() itself, as the incompatibility between other types of buffers and cursor planes is different from the incompatibility between formats. This makes the code easier to read and also documents the current incompatibility between cursor planes and buffers that are not created through wl_shm. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
2984f36c72
commit
4b5df8b39f
@@ -169,7 +169,11 @@ drm_output_plane_cursor_has_valid_format(struct weston_view *ev)
|
||||
struct wl_shm_buffer *shmbuf =
|
||||
wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource);
|
||||
|
||||
if (shmbuf && wl_shm_buffer_get_format(shmbuf) == WL_SHM_FORMAT_ARGB8888)
|
||||
/* When we have cursor planes we've already checked for wl_shm buffer in
|
||||
* the view before calling this function. */
|
||||
assert(shmbuf);
|
||||
|
||||
if (wl_shm_buffer_get_format(shmbuf) == WL_SHM_FORMAT_ARGB8888)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -657,6 +661,8 @@ drm_output_prepare_plane_view(struct drm_output_state *state,
|
||||
struct drm_plane_zpos *p_zpos, *p_zpos_next;
|
||||
struct wl_list zpos_candidate_list;
|
||||
|
||||
struct weston_buffer *buffer;
|
||||
struct wl_shm_buffer *shmbuf;
|
||||
struct drm_fb *fb;
|
||||
|
||||
wl_list_init(&zpos_candidate_list);
|
||||
@@ -665,6 +671,8 @@ drm_output_prepare_plane_view(struct drm_output_state *state,
|
||||
if (!weston_view_has_valid_buffer(ev))
|
||||
return ps;
|
||||
|
||||
buffer = ev->surface->buffer_ref.buffer;
|
||||
shmbuf = wl_shm_buffer_get(buffer->resource);
|
||||
fb = drm_fb_get_from_view(state, ev);
|
||||
|
||||
/* assemble a list with possible candidates */
|
||||
@@ -719,6 +727,14 @@ drm_output_prepare_plane_view(struct drm_output_state *state,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (plane->type == WDRM_PLANE_TYPE_CURSOR && !shmbuf) {
|
||||
drm_debug(b, "\t\t\t\t[plane] not adding plane %d, type cursor to "
|
||||
"candidate list: cursor planes only support wl_shm "
|
||||
"buffers and the view buffer is of another type\n",
|
||||
plane->plane_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!drm_output_plane_view_has_valid_format(plane, state, ev, fb)) {
|
||||
drm_debug(b, "\t\t\t\t[plane] not adding plane %d to "
|
||||
"candidate list: invalid pixel format\n",
|
||||
|
||||
Reference in New Issue
Block a user