wayland: Move buffer use count to MetaWaylandSurface
Each wl_surface.commit with a newly attached buffer should result in one wl_buffer.release for the attached buffer. For example attaching the same buffer to two different surfaces must always result in two wl_buffer.release events being emitted by the server. The client is responsible for counting the wl_buffer.release events and be sure to have received as many release events as it has attached and committed the buffer, before reusing it. https://bugzilla.gnome.org/show_bug.cgi?id=762828
This commit is contained in:
@ -966,24 +966,25 @@ update_cursor_sprite_texture (MetaWaylandSurface *surface)
|
||||
MetaWaylandSurfaceRoleCursor *cursor_role =
|
||||
META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role);
|
||||
MetaCursorSprite *cursor_sprite = cursor_role->cursor_sprite;
|
||||
MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface);
|
||||
|
||||
g_return_if_fail (!surface->buffer || surface->buffer->texture);
|
||||
g_return_if_fail (!buffer || buffer->texture);
|
||||
|
||||
if (surface->buffer)
|
||||
if (buffer)
|
||||
{
|
||||
meta_cursor_sprite_set_texture (cursor_sprite,
|
||||
surface->buffer->texture,
|
||||
buffer->texture,
|
||||
cursor_role->hot_x * surface->scale,
|
||||
cursor_role->hot_y * surface->scale);
|
||||
|
||||
if (surface->using_buffer)
|
||||
if (surface->buffer_ref.use_count > 0)
|
||||
{
|
||||
struct wl_resource *buffer;
|
||||
struct wl_resource *buffer_resource;
|
||||
|
||||
buffer = surface->buffer->resource;
|
||||
buffer_resource = buffer->resource;
|
||||
meta_cursor_renderer_realize_cursor_from_wl_buffer (cursor_renderer,
|
||||
cursor_sprite,
|
||||
buffer);
|
||||
buffer_resource);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user