libweston: Add a new helper weston_view_has_valid_buffer
Helper to determine if the buffer attached to the view is valid. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
e83e750183
commit
5f6bee49ed
@@ -278,7 +278,7 @@ drm_output_prepare_cursor_view(struct drm_output_state *output_state,
|
|||||||
if (b->gbm == NULL)
|
if (b->gbm == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (ev->surface->buffer_ref.buffer == NULL) {
|
if (!weston_view_has_valid_buffer(ev)) {
|
||||||
drm_debug(b, "\t\t\t\t[cursor] not assigning view %p to cursor plane "
|
drm_debug(b, "\t\t\t\t[cursor] not assigning view %p to cursor plane "
|
||||||
"(no buffer available)\n", ev);
|
"(no buffer available)\n", ev);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -546,7 +546,7 @@ drm_output_propose_state(struct weston_output *output_base,
|
|||||||
force_renderer = true;
|
force_renderer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ev->surface->buffer_ref.buffer) {
|
if (!weston_view_has_valid_buffer(ev)) {
|
||||||
drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane "
|
drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane "
|
||||||
"(no buffer available)\n", ev);
|
"(no buffer available)\n", ev);
|
||||||
force_renderer = true;
|
force_renderer = true;
|
||||||
@@ -764,7 +764,7 @@ drm_assign_planes(struct weston_output *output_base, void *repaint_data)
|
|||||||
* to the buffer anyway, there is no side effects.
|
* to the buffer anyway, there is no side effects.
|
||||||
*/
|
*/
|
||||||
if (b->use_pixman ||
|
if (b->use_pixman ||
|
||||||
(ev->surface->buffer_ref.buffer &&
|
(weston_view_has_valid_buffer(ev) &&
|
||||||
(!wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource) ||
|
(!wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource) ||
|
||||||
(ev->surface->width <= b->cursor_width &&
|
(ev->surface->width <= b->cursor_width &&
|
||||||
ev->surface->height <= b->cursor_height))))
|
ev->surface->height <= b->cursor_height))))
|
||||||
|
|||||||
@@ -1852,6 +1852,18 @@ weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check if the view has a valid buffer available
|
||||||
|
*
|
||||||
|
* @param ev The view to check if it has a valid buffer.
|
||||||
|
*
|
||||||
|
* Returns true if the view has a valid buffer or false otherwise.
|
||||||
|
*/
|
||||||
|
WL_EXPORT bool
|
||||||
|
weston_view_has_valid_buffer(struct weston_view *ev)
|
||||||
|
{
|
||||||
|
return ev->surface->buffer_ref.buffer != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if a surface has a view assigned to it
|
/* Check if a surface has a view assigned to it
|
||||||
*
|
*
|
||||||
* The indicator is set manually when mapping
|
* The indicator is set manually when mapping
|
||||||
|
|||||||
@@ -287,6 +287,9 @@ weston_view_from_global_float(struct weston_view *view,
|
|||||||
bool
|
bool
|
||||||
weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
|
weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
|
||||||
|
|
||||||
|
bool
|
||||||
|
weston_view_has_valid_buffer(struct weston_view *ev);
|
||||||
|
|
||||||
void
|
void
|
||||||
weston_view_move_to_plane(struct weston_view *view,
|
weston_view_move_to_plane(struct weston_view *view,
|
||||||
struct weston_plane *plane);
|
struct weston_plane *plane);
|
||||||
|
|||||||
Reference in New Issue
Block a user