mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
buffer: drop wlr_client_buffer.resource
This commit is contained in:
parent
d7c68ce632
commit
4554f17377
2 changed files with 0 additions and 31 deletions
|
@ -127,10 +127,6 @@ struct wlr_buffer *wlr_buffer_from_resource(struct wlr_renderer *renderer,
|
||||||
struct wlr_client_buffer {
|
struct wlr_client_buffer {
|
||||||
struct wlr_buffer base;
|
struct wlr_buffer base;
|
||||||
|
|
||||||
/**
|
|
||||||
* The buffer resource, if any. Will be NULL if the client destroys it.
|
|
||||||
*/
|
|
||||||
struct wl_resource *resource;
|
|
||||||
/**
|
/**
|
||||||
* The buffer's texture, if any. A buffer will not have a texture if the
|
* The buffer's texture, if any. A buffer will not have a texture if the
|
||||||
* client destroys the buffer before it has been released.
|
* client destroys the buffer before it has been released.
|
||||||
|
@ -143,7 +139,6 @@ struct wlr_client_buffer {
|
||||||
|
|
||||||
// private state
|
// private state
|
||||||
|
|
||||||
struct wl_listener resource_destroy;
|
|
||||||
struct wl_listener source_destroy;
|
struct wl_listener source_destroy;
|
||||||
|
|
||||||
// If the client buffer has been created from a wl_shm buffer
|
// If the client buffer has been created from a wl_shm buffer
|
||||||
|
|
|
@ -123,7 +123,6 @@ static struct wlr_client_buffer *client_buffer_from_buffer(
|
||||||
|
|
||||||
static void client_buffer_destroy(struct wlr_buffer *buffer) {
|
static void client_buffer_destroy(struct wlr_buffer *buffer) {
|
||||||
struct wlr_client_buffer *client_buffer = client_buffer_from_buffer(buffer);
|
struct wlr_client_buffer *client_buffer = client_buffer_from_buffer(buffer);
|
||||||
wl_list_remove(&client_buffer->resource_destroy.link);
|
|
||||||
wl_list_remove(&client_buffer->source_destroy.link);
|
wl_list_remove(&client_buffer->source_destroy.link);
|
||||||
wlr_texture_destroy(client_buffer->texture);
|
wlr_texture_destroy(client_buffer->texture);
|
||||||
free(client_buffer);
|
free(client_buffer);
|
||||||
|
@ -145,22 +144,6 @@ static const struct wlr_buffer_impl client_buffer_impl = {
|
||||||
.get_dmabuf = client_buffer_get_dmabuf,
|
.get_dmabuf = client_buffer_get_dmabuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void client_buffer_resource_handle_destroy(struct wl_listener *listener,
|
|
||||||
void *data) {
|
|
||||||
struct wlr_client_buffer *client_buffer =
|
|
||||||
wl_container_of(listener, client_buffer, resource_destroy);
|
|
||||||
wl_list_remove(&client_buffer->resource_destroy.link);
|
|
||||||
wl_list_init(&client_buffer->resource_destroy.link);
|
|
||||||
client_buffer->resource = NULL;
|
|
||||||
|
|
||||||
// At this point, if the wl_buffer comes from linux-dmabuf or wl_drm, we
|
|
||||||
// still haven't released it (ie. we'll read it in the future) but the
|
|
||||||
// client destroyed it. Reading the texture itself should be fine because
|
|
||||||
// we still hold a reference to the DMA-BUF via the texture. However the
|
|
||||||
// client could decide to re-use the same DMA-BUF for something else, in
|
|
||||||
// which case we'll read garbage. We decide to accept this risk.
|
|
||||||
}
|
|
||||||
|
|
||||||
static void client_buffer_handle_source_destroy(struct wl_listener *listener,
|
static void client_buffer_handle_source_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_client_buffer *client_buffer =
|
struct wlr_client_buffer *client_buffer =
|
||||||
|
@ -224,13 +207,9 @@ struct wlr_client_buffer *wlr_client_buffer_create(struct wlr_buffer *buffer,
|
||||||
}
|
}
|
||||||
wlr_buffer_init(&client_buffer->base, &client_buffer_impl,
|
wlr_buffer_init(&client_buffer->base, &client_buffer_impl,
|
||||||
texture->width, texture->height);
|
texture->width, texture->height);
|
||||||
client_buffer->resource = resource;
|
|
||||||
client_buffer->source = buffer;
|
client_buffer->source = buffer;
|
||||||
client_buffer->texture = texture;
|
client_buffer->texture = texture;
|
||||||
|
|
||||||
wl_resource_add_destroy_listener(resource, &client_buffer->resource_destroy);
|
|
||||||
client_buffer->resource_destroy.notify = client_buffer_resource_handle_destroy;
|
|
||||||
|
|
||||||
wl_signal_add(&buffer->events.destroy, &client_buffer->source_destroy);
|
wl_signal_add(&buffer->events.destroy, &client_buffer->source_destroy);
|
||||||
client_buffer->source_destroy.notify = client_buffer_handle_source_destroy;
|
client_buffer->source_destroy.notify = client_buffer_handle_source_destroy;
|
||||||
|
|
||||||
|
@ -300,11 +279,6 @@ struct wlr_client_buffer *wlr_client_buffer_apply_damage(
|
||||||
|
|
||||||
wl_shm_buffer_end_access(shm_buf);
|
wl_shm_buffer_end_access(shm_buf);
|
||||||
|
|
||||||
wl_list_remove(&client_buffer->resource_destroy.link);
|
|
||||||
wl_resource_add_destroy_listener(resource, &client_buffer->resource_destroy);
|
|
||||||
client_buffer->resource_destroy.notify = client_buffer_resource_handle_destroy;
|
|
||||||
|
|
||||||
client_buffer->resource = resource;
|
|
||||||
return client_buffer;
|
return client_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue