mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
surface: fix texture not updated on commit
When a client attaches a wl_drm or a linux_dmabuf buffer, we only update it if the size is different from the one of the old buffer. This means that if the client attaches a new, updated buffer with the same size as the old buffer, the texture won't get updated. This commit changes this behavior and re-creates the texture if the client attaches a new buffer, without requiring the size to be different.
This commit is contained in:
parent
4137d9fc80
commit
6bbf507082
1 changed files with 5 additions and 6 deletions
|
@ -331,7 +331,7 @@ static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
|
|||
}
|
||||
|
||||
static void wlr_surface_apply_damage(struct wlr_surface *surface,
|
||||
bool reupload_buffer) {
|
||||
bool invalid_buffer, bool reupload_buffer) {
|
||||
struct wl_resource *resource = surface->current->buffer;
|
||||
if (resource == NULL) {
|
||||
return;
|
||||
|
@ -374,7 +374,7 @@ static void wlr_surface_apply_damage(struct wlr_surface *surface,
|
|||
}
|
||||
|
||||
wl_shm_buffer_end_access(buf);
|
||||
} else if (!surface->texture || reupload_buffer) {
|
||||
} else if (invalid_buffer || reupload_buffer) {
|
||||
wlr_texture_destroy(surface->texture);
|
||||
|
||||
if (wlr_renderer_resource_is_wl_drm_buffer(surface->renderer, resource)) {
|
||||
|
@ -398,9 +398,8 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
|
|||
int32_t oldw = surface->current->buffer_width;
|
||||
int32_t oldh = surface->current->buffer_height;
|
||||
|
||||
bool null_buffer_commit =
|
||||
(surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER &&
|
||||
surface->pending->buffer == NULL);
|
||||
bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
|
||||
bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
|
||||
|
||||
wlr_surface_move_state(surface, surface->pending, surface->current);
|
||||
|
||||
|
@ -411,7 +410,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
|
|||
|
||||
bool reupload_buffer = oldw != surface->current->buffer_width ||
|
||||
oldh != surface->current->buffer_height;
|
||||
wlr_surface_apply_damage(surface, reupload_buffer);
|
||||
wlr_surface_apply_damage(surface, invalid_buffer, reupload_buffer);
|
||||
|
||||
// commit subsurface order
|
||||
struct wlr_subsurface *subsurface;
|
||||
|
|
Loading…
Reference in a new issue